File: rc6.patch.in

package info (click to toggle)
apcupsd 3.12.4-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 41,116 kB
  • ctags: 6,199
  • sloc: ansic: 42,488; sh: 8,031; cpp: 3,740; makefile: 1,897; perl: 1,723; tcl: 368; php: 107; sed: 93
file content (56 lines) | stat: -rw-r--r-- 2,072 bytes parent folder | download | duplicates (11)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--- rc.6.orig   Sat Sep 11 14:38:33 1999
+++ rc.6        Sun Feb 27 13:22:11 2000
@@ -84,11 +84,31 @@
   # This never hurts:
   sync
 
+  # This block was from the original Slackware distribution:
   # See if this is a powerfail situation.
-  if [ -x /sbin/genpowerd ]; then
- # See if this is a powerfail situation:
-   if grep FAIL /etc/upsstatus 1> /dev/null 2> /dev/null ; then
- # Signal UPS to shut off the inverter:
-     /sbin/genpowerd -k /dev/UPS apc-linux
-     if [ ! $? = 0 ]; then
-       echo
-       echo "There was an error signaling the UPS."
-       echo "Perhaps you need to edit /etc/rc.d/rc.6 to configure"
-       echo "the serial line and UPS type."
-         # Wasting 15 seconds of precious power:
-       sleep 15
-     fi
-   fi
+  # if [ -x /sbin/genpowerd ]; then
+  #  # See if this is a powerfail situation:
+  #  if grep FAIL /etc/upsstatus 1> /dev/null 2> /dev/null ; then
+  #  # Signal UPS to shut off the inverter:
+  #    /sbin/genpowerd -k /dev/UPS apc-linux
+  #    if [ ! $? = 0 ]; then
+  #      echo
+  #      echo "There was an error signaling the UPS."
+  #      echo "Perhaps you need to edit /etc/rc.d/rc.6 to configure"
+  #      echo "the serial line and UPS type."
+  #  # Wasting 15 seconds of precious power:
+  #      sleep 15
+  #    fi
+  #  fi
+  # fi
+
+  # This block was added in by the apcupsd installation process.  This
+  # will cause the UPS to kill the power supply after a configurable number
+  # of seconds (see the apcupsd.conf file).  This is important for situations
+  # where the mains power comes back before the UPS batteries are completely
+  # dead.
+  if [ -f @PWRFAILDIR@/powerfail ]; then
+    echo
+    echo "apcupsd will now power off the UPS"
+    echo
+    @sysconfdir@/apccontrol killpower
+    echo
+    echo "Please ensure that the UPS has powered off before rebooting."
+    echo "Otherwise, the UPS may cut the power during the reboot."
+    echo
+    halt -f -p         # power down the system if the hardware is capable
   fi
 
   # Now halt (poweroff with APM kernels) or reboot.