3 AUTHOR: John McSwain <jmcswain@infoave.net>
\r
6 Installing Apcupsd to protect an LFS system using APC UPS.
\r
9 version 1.0 (06/27/2001)
\r
11 ========================
\r
13 ========================
\r
20 3.2.2 Poweroff script
\r
21 3.2.3 Symlink the scripts
\r
30 Apcupsd is useful for controlling American Power Conversion's (APC)
\r
31 uninterruptiple power supplies (UPS). Apcupsd monitors the UPS and during a
\r
32 power loss, informs the system users of the failure, and if power is not
\r
33 restored, safely shuts down the system. The Apcupsd manual (available on line
\r
34 at http://www.sibbald.com/apcupsd/manual/index.html or with the software)
\r
35 provides excellent instructions on installing and configuring the software.
\r
36 The configure script can identify several standard linux distributions and make
\r
37 the correct installation. However, as LFS is by design not standard this hint
\r
38 provides the information to protect an LFS system with an APC UPS using
\r
41 The installation of Apcupsd is mostly straightforward until "make install" is
\r
42 completed. Then the LFS user will see the following series of messages:
\r
44 "Unknown distribution
\r
45 You have to manually install apcupsd boot script and
\r
46 halt script for clean emergency shutdown.
\r
47 Please contribute your distribution install to apcupsd team.
\r
48 I'm sorry: you are on your own."
\r
50 The purpose of this hint is to provide one method of accomplishing the above
\r
51 actions to get Apcupsd up and running on the LFS "unknown" distribution.
\r
57 The Apcupsd software can be found at these sites:
\r
59 http://www.oasi.gpa.it/riccardo/linux/apcupsd/
\r
60 http://www.sibbald.com/apcupsd/
\r
61 ftp://ftp.oasi.gpa.it/pub/apcupsd/
\r
63 As of this writing the latest stable release is Apcupsd-3.8.1. However
\r
64 Apcupsd-3.8.2Beta14 has been used with no problems by this author.
\r
71 Obtain the source and unpack it in a suitable place such as /usr/src/.
\r
72 Compiler optimizations can be used with Apcupsd. See Optimization.txt hint
\r
73 and the Apcupsd manual for more information.
\r
78 Run the following command:
\r
80 ./configure --prefix=/usr --sbindir=/sbin
\r
82 This is a basic installation. If you have a smartups and wish to have a web
\r
83 interface to the APC unit's status from your web server see the Apcupsd manual.
\r
84 You will probably want to run the above commands with additions:
\r
86 ./configure --prefix=/usr --sbindir=/sbin \
\r
87 --with-cgi-bin=/home/httpd/cgi-bin --enable-cgi
\r
98 At the end of the make install you will get the messages listed above in the
\r
99 introduction. A bootscript and proper halt script must be manually
\r
106 Use the template script in /etc/init.d as a guide to make the boot script.
\r
109 cp template apcupsd
\r
111 Now edit the apcupsd file to make the following bootscript:
\r
114 # Begin /etc/init.d/apcupsd
\r
116 # S200 in /etc/rc{2,3,4,5}.d and K990 /etc/rc{0,1,6}.d
\r
118 source /etc/init.d/functions
\r
122 # House keeping if this were a restart from powerfail
\r
123 rm -f /etc/apcupsd/powerfail
\r
126 echo -n "Starting apcupsd power management ..."
\r
127 loadproc /sbin/apcupsd
\r
131 echo -n "Stopping apcupsd power management..."
\r
136 echo -n "Reloading apcupsd power management ..."
\r
151 echo "Usage: $0 {start|stop|reload|restart|status}"
\r
157 # End /etc/init.d/apcupsd
\r
160 =====================
\r
161 3.2.2 Poweroff script
\r
162 =====================
\r
164 This poweroff script is needed to shutdown the UPS after the system has halted.
\r
165 (Note: Depending on the UPS this could take a minute or two). Thus when the
\r
166 power returns the UPS will come back on and the system will power up (providing
\r
167 your atx bios supports powerup).
\r
169 Apcupsd for most distributions modifies the existing halt script. Rather than
\r
170 that route we are making a separate script called UPSdown.
\r
172 Using a text editor create UPSdown as follows in /etc/init.d:
\r
175 # Begin /etc/init.d/UPSdown
\r
177 # Script to shutdown UPS after computer shutdown
\r
179 # Symlink in rc0.d after umounting filesystems
\r
182 # See if this is a powerfail situation
\r
183 if [ -f /etc/apcupsd/powerfail ]; then
\r
185 echo "APCUPSD will now power off the UPS"
\r
187 /etc/apcupsd/apccontrol killpower
\r
189 echo "Verify the UPS shuts down or turn off the system"
\r
193 # End /etc/init.d/UPSdown
\r
196 =========================
\r
197 3.2.3 Symlink the scripts
\r
198 =========================
\r
199 The apcupsd daemon should be started fairly soon in the boot cycle to provide
\r
200 protection. Using three digit symlinks, S200 for my system seems appropriate.
\r
201 Use your own judgement here.
\r
203 Stopping the daemon should occur fairly late. I use K990.
\r
205 The UPSdown script should be run immediately prior to the halt script. If
\r
206 halt is S999 then UPSdown would be S998.
\r
211 chmod 754 apcupsd UPSdown &&
\r
213 ln -s ../init.d/apcupsd K990apcupsd &&
\r
214 ln -s ../init.d/UPSdown S998UPSdown &&
\r
216 ln -s ../init.d/apcupsd K990apcupsd &&
\r
218 ln -s ../init.d/apcupsd S200apcupsd &&
\r
220 ln -s ../init.d/apcupsd S200apcupsd &&
\r
222 ln -s ../init.d/apcupsd S200apcupsd &&
\r
224 ln -s ../init.d/apcupsd S200apcupsd &&
\r
226 ln -s ../init.d/apcupsd K990apcupsd
\r
233 Our generic configure in 3.1 above placed the configuration file in
\r
234 /etc/apcupsd. This file is called apcupsd.conf. Pleae consult the apcupsd
\r
235 manual to determine the settings for your system and APC model UPS.
\r
240 The above steps were an attempt to have you quickly provide APC UPS power
\r
241 protection to your system using Apcupsd software. The software allows the
\r
242 individual user a lot of options depending on his needs and desires. For
\r
243 example I use the cgi feature to be able to see the status of my UPS from a
\r
244 browser. I use the notification feature to mail the electric company that I
\r
245 have loss power. These and other features along with a description of the
\r
246 workings of Apcupsd are fully described in the Apcupsd manual.
\r