--- ./platforms/apccontrol.in.orig 2014-03-22 16:55:26.000000000 +0000 +++ ./platforms/apccontrol.in 2014-05-01 08:35:12.652406970 +0000 @@ -20,10 +20,19 @@ 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 +} export SYSADMIN=root export APCUPSD_MAIL="@APCUPSD_MAIL@" @@ -104,11 +113,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}