57 lines
1.1 KiB
Bash
Executable File
57 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# PROVIDE: aquastat
|
|
# REQUIRE: NETWORKING
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# aquastat (bool): Set to NO by default.
|
|
# Set it to YES to enable aquastat.
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="aquastat"
|
|
rcvar=aquastat_enable
|
|
pidfile=/var/run/aquastat.pid
|
|
procname=python3
|
|
|
|
start_cmd=aquastat_start
|
|
stop_cmd=aquastat_stop
|
|
status_cmd=aquastat_status
|
|
|
|
command="/home/dponte/aquastat/start.sh"
|
|
|
|
aquastat_start() {
|
|
echo "Starting ${name}."
|
|
/usr/sbin/daemon -p ${pidfile} -f -u dponte $command
|
|
}
|
|
|
|
|
|
aquastat_stop() {
|
|
if [ -e "${pidfile}" ]; then
|
|
echo "Stopping ${name}."
|
|
kill -s TERM `cat ${pidfile}`
|
|
else
|
|
echo "${name} is not running"
|
|
fi
|
|
|
|
}
|
|
|
|
aquastat_status() {
|
|
if [ -e "${pidfile}" ]; then
|
|
echo "${name} is running as pid `cat ${pidfile}`"
|
|
else
|
|
echo "${name} is not running"
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
|
|
: ${aquastat_enable="NO"}
|
|
: ${aquastat_user="dponte"}
|
|
: ${aquastat_group="dponte"}
|
|
|
|
run_rc_command "$1"
|