blob: 3f5c6965b772171ac96d49e4f3d04816d1f9e8fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
--- 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}
|