#!/bin/sh

PATH=/usr/bin:/bin
MSG="power failure event, powering off ..."
# stopit has already the x mode set if exists
touch /etc/runit/stopit
chmod +x /etc/runit/stopit
echo "$MSG" | wall
exit

##perform alternative action, do not shutdown
# ..do stuff here..
#touch /etc/runit/stopit
#chmod -x /etc/runit/stopit ; exit

##reboot instead of poweroff
#touch /etc/runit/stopit; touch /etc/runit/reboot
#chmod -x /etc/runit/stopit
#chmod +x /etc/runit/reboot
