weewx.rc 929 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # Start script for FreeBSD, contributed by user Fabian Abplanalp
  3. # Put this script in /usr/local/etc/rc.d then adjust WEEWX_BIN and
  4. # WEEWX_CFG values in /etc/defaults/weewx
  5. WEEWX_BIN="/usr/local/bin/python3.8 /usr/local/src/weewx/weewx-4.7.0/bin/weewxd"
  6. WEEWX_CFG="/usr/local/etc/weewx.conf"
  7. WEEWX_PID="/var/run/weewx.pid"
  8. # Read configuration variable file if it is present
  9. [ -r /etc/defaults/weewx ] && . /etc/defaults/weewx
  10. case "$1" in
  11. "start")
  12. echo "Starting weewx..."
  13. ${WEEWX_BIN} --config ${WEEWX_CFG} --daemon &
  14. echo $! >${WEEWX_PID}
  15. echo "done"
  16. ;;
  17. "stop")
  18. echo "Stopping weewx..."
  19. if [ -f ${WEEWX_PID} ]; then
  20. kill $(cat ${WEEWX_PID})
  21. rm ${WEEWX_PID}
  22. echo "done"
  23. else
  24. echo "not running?"
  25. fi
  26. ;;
  27. "restart")
  28. echo "Restarting weewx..."
  29. $0 stop
  30. sleep 2
  31. $0 start
  32. ;;
  33. *)
  34. echo "$0 [start|stop|restart]"
  35. ;;
  36. esac