12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #!/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="/usr/local/bin/python3.8 /usr/local/src/weewx/weewx-4.7.0/bin/weewxd"
- WEEWX_CFG="/usr/local/etc/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} --config ${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
|