Files
weewx/start_scripts/BSD/weewx
2012-01-23 01:34:13 +00:00

41 lines
728 B
Bash
Executable File

#!/bin/sh
#
# Start script for FreeBSD, contributed by user Fabian Abplanalp
# Adjust WEEWX_ROOT as appropriate.
# Then put this script in /usr/local/etc/rc.d
#
WEEWX_ROOT="/opt/weewx"
PIDFILE="/var/run/weewx.pid"
case "$1" in
"start")
echo "Starting weewx..."
/usr/local/bin/python ${WEEWX_ROOT}/bin/weewxd.py ${WEEWX_ROOT}/weewx.conf --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