upsd.init 449 B

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