1
0

upsd.init 476 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. #PKG nut
  3. #INIT 60
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${upsd:-NO}" = x"NO" && exit 0
  9. exec sh $0 start
  10. ;;
  11. start)
  12. [ -d /var/state/ups ] || mkdir -p /var/state/ups
  13. /usr/bin/upsdrvctl start || exit 1
  14. /usr/sbin/upsd || exit 2
  15. ;;
  16. stop)
  17. /usr/sbin/upsd -c stop || kill $(pgrep -f /usr/sbin/upsd)
  18. /usr/bin/upsdrvctl stop
  19. ;;
  20. restart)
  21. sh $0 stop
  22. sleep 1
  23. sh $0 start
  24. ;;
  25. *)
  26. echo "Usage: $0 {start | stop | restart}"
  27. exit 1
  28. ;;
  29. esac
  30. exit $?