--- a/platforms/apccontrol.in Mon Oct 26 09:12:30 2009 +++ b/platforms/apccontrol.in Mon Oct 26 09:36:47 2009 @@ -20,11 +20,20 @@ APCPID=@PIDDIR@/apcupsd.pid APCUPSD=@sbindir@/apcupsd -SHUTDOWN=@SHUTDOWN@ +POWEROFF=/sbin/poweroff +REBOOT=/sbin/reboot SCRIPTSHELL=@SCRIPTSHELL@ SCRIPTDIR=@sysconfdir@ -WALL=wall +WALL=_wall +_wall() { + local i + local msg=$(cat) + for i in /dev/pts/*; do + [ -c "$i" ] && echo "$msg" > $i + done +} + # # Concatenate all output from this script to the events file # Note, the following kills the script in a power fail situation @@ -100,11 +109,13 @@ ;; doreboot) echo "UPS ${2} initiating Reboot Sequence" | ${WALL} - ${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot" + echo "apcupsd UPS ${2} initiated reboot" | ${WALL} + $REBOOT ;; doshutdown) echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} - ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" + echo "apcupsd UPS ${2} initiated shutdown" | ${WALL} + $POWEROFF ;; annoyme) echo "Power problems with UPS ${2}. Please logoff." | ${WALL}