apcupsd.powerfail.init 397 B

123456789101112131415161718
  1. #!/sbin/openrc-run
  2. # Copyright 2009 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. description='Signal the UPS to kill power in a power failure condition'
  5. depend() {
  6. need mount-ro
  7. }
  8. start() {
  9. if [ "$(runlevel | cut -d' ' -f2)" = "0" -a -f /etc/apcupsd/powerfail ] ; then
  10. ebegin 'Signaling UPS to kill power'
  11. /sbin/apcupsd --killpower
  12. eend $?
  13. fi
  14. }