FreeBSD/jails/config/maps/maps
2020-05-26 21:15:31 -07:00

45 lines
981 B
Bash
Executable File

#!/bin/sh
# Copyright (c) 2018-2019, diyIT.org
# All rights reserved.
#
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
# https://diyit.org/license/
#
#
# the two lines below are not just comments but required by rcorder; service -e
# PROVIDE: mapsserver
# REQUIRE: NETWORKING DAEMON
. /etc/rc.subr
: ${mapsserver_enable="NO"}
name=mapsserver
rcvar=${name}_enable
start_cmd="${name}_start"
stop_cmd="${name}_stop"
restart_cmd="${name}_restart"
mapsserver_start()
{
cd /data/networkmaps; ./server.js --config /usr/local/etc/networkmaps/config.json &
cd /data/networkmaps; ./smtp_daemon.js --config /usr/local/etc/networkmaps/config.json &
}
mapsserver_stop()
{
ps ax | grep -ie server.js | grep -v grep | awk '{print $1}' | xargs kill -9
ps ax | grep -ie smtp_daemon.js | grep -v grep | awk '{print $1}' | xargs kill -9
}
mapsserver_restart()
{
mapsserver_stop
mapsserver_start
}
load_rc_config ${name}
run_rc_command "$1"