summaryrefslogtreecommitdiff
path: root/system/apcupsd/README-SLACKWARE
blob: b4d6a1a93aba871f50733d50c316ae447c768429 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
README-SLACKWARE
Written by Robby Workman <rworkman@slackbuilds.org>


First, see /usr/doc/apcupsd-3.14.0/examples/make-hiddev if you're using
a 2.4.x kernel and need to manually create the device node(s).


Second, you'll need to start the apcupsd service at boot.
The recommended way is to add the following to your /etc/rc.d/rc.local
script:

  if [ -x /etc/rc.d/rc.apcupsd ]; then
    /etc/rc.d/rc.apcupsd start
  fi

Make sure the rc.apcupsd script is executable.


Finally, you'll need to edit your /etc/rc.d/rc.6 script for apcupsd
to perform the shutdown on power failures.  Here's the short version:
Scroll down to the end of rc.6 - you should see a section that calls 
/sbin/genpowerd.  Comment out (or remove) this entire section:

  if [ -x /sbin/genpowerd ]; then
    # See if this is a powerfail situation:
    if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
      # Signal UPS to shut off the inverter:
      /sbin/genpowerd -k
      if [ ! $? = 0 ]; then
        echo
        echo "There was an error signaling the UPS."
        echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
        echo "the serial line and UPS type."
        # Wasting 15 seconds of precious power:
        /bin/sleep 15
      fi
    fi
  fi


Now replace that section with this (or add immediately after it if you
chose to comment out the original):
  
  # 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 /etc/powerfail ]; then
    echo
    echo "apcupsd will now power off the UPS"
    echo
    /etc/apcupsd/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