45 lines
939 B
Bash
Executable File
45 lines
939 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
|
|
|
|
: ${maps_enable="NO"}
|
|
|
|
name=maps
|
|
rcvar=${name}_enable
|
|
|
|
start_cmd="${name}_start"
|
|
stop_cmd="${name}_stop"
|
|
restart_cmd="${name}_restart"
|
|
|
|
maps_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 &
|
|
}
|
|
|
|
maps_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
|
|
}
|
|
maps_restart()
|
|
{
|
|
maps_stop
|
|
maps_start
|
|
}
|
|
|
|
load_rc_config ${name}
|
|
run_rc_command "$1"
|