Files
weewx/util/init.d/weewx.bsd
2013-01-28 18:23:05 +00:00

42 lines
759 B
Bash
Executable File

#!/bin/sh
#
# Start script for FreeBSD, contributed by user Fabian Abplanalp
# Adjust app and cfg locations as appropriate, then put this script
# in /usr/local/etc/rc.d
#
WEEWX_BIN="/opt/weewx/bin/weewxd.py"
WEEWX_CFG="/opt/weewx/weewx.conf"
PIDFILE="/var/run/weewx.pid"
case "$1" in
"start")
echo "Starting weewx..."
/usr/local/bin/python ${WEEWX_BIN} ${WEEWX_CFG} --daemon &
echo $! > ${PIDFILE}
echo "done"
;;
"stop")
echo "Stopping weewx..."
if [ -f ${PIDFILE} ] ; then
kill `cat ${PIDFILE}`
rm ${PIDFILE}
echo "done"
else
echo "not running?"
fi
;;
"restart")
echo "Restarting weewx..."
$0 stop
sleep 2
$0 start
;;
*)
echo "$0 [start|stop|restart]"
;;
esac