mirror of
https://github.com/weewx/weewx.git
synced 2026-04-20 17:46:58 -04:00
44 lines
862 B
Bash
Executable File
44 lines
862 B
Bash
Executable File
#!/bin/sh
|
|
# Start script for FreeBSD, contributed by user Fabian Abplanalp
|
|
# Put this script in /usr/local/etc/rc.d then adjust WEEWX_BIN and
|
|
# WEEWX_CFG values in /etc/defaults/weewx
|
|
|
|
WEEWX_BIN="/opt/weewx/bin/weewxd"
|
|
WEEWX_CFG="/opt/weewx/weewx.conf"
|
|
WEEWX_PID="/var/run/weewx.pid"
|
|
|
|
# Read configuration variable file if it is present
|
|
[ -r /etc/defaults/weewx ] && . /etc/defaults/weewx
|
|
|
|
case "$1" in
|
|
"start")
|
|
echo "Starting weewx..."
|
|
${WEEWX_BIN} ${WEEWX_CFG} --daemon &
|
|
echo $! > ${WEEWX_PID}
|
|
echo "done"
|
|
;;
|
|
|
|
"stop")
|
|
echo "Stopping weewx..."
|
|
if [ -f ${WEEWX_PID} ] ; then
|
|
kill `cat ${WEEWX_PID}`
|
|
rm ${WEEWX_PID}
|
|
echo "done"
|
|
else
|
|
echo "not running?"
|
|
fi
|
|
;;
|
|
|
|
"restart")
|
|
echo "Restarting weewx..."
|
|
$0 stop
|
|
sleep 2
|
|
$0 start
|
|
;;
|
|
|
|
*)
|
|
echo "$0 [start|stop|restart]"
|
|
;;
|
|
|
|
esac
|