参照file:///usr/share/doc/upsd/README说明文件,里面有
Belkin ReSource F5C520c UPS
===========================
This UPS comes with what looks like a standard DB-9 M-F serial cable but
it is wired differently. There appear to be no internal resistors (the
UPS may have an internal circuit with the pullup resistors for the status
lines). The pinout appears to be as follows:
DB-9 (PC side, female) DB-9 (UPS side, male)
---------------------- ---------------------
Pin Pin Meaning
--- --- ------
1 (DCD) <--------------------------- 1 LOW BATTERY
3 (Tx) ---------------------------> 5 ?? (PC's Tx tied to GND?)--我的解释:7提供Vcc+, 3提供Vcc-, 学电子电路的人应该明白的。
4 (DTR) ---------------------------> 4 UPS Shutoff (when on battery)
7 (RTS) ---------------------------> 7 Power to UPS status lines
8 (CTS) <--------------------------- 8 ACFAIL
到此,已经完成了一大半,可以先测试一下再作进一步工作:
1.把UPS接上市电,输出那里接个显示器或风扇或台灯--反正不能接主机
2.再把RS-232连接线把主机串口与UPS控制器连接起来
3./etc/init.d/upsd start
4.cat /etc/upstatus,正常应显示0:0 Power = OK:Power = OK
5.拔下市电,重复4, 0:0会变成0:1, 过大约10秒,会变成1:1
6.重新插上市电,重复4, 1:1会变成1:0, 过一会变成0:0
--到这里,表明upsd已经正常工作了
但在上述过程的中间有个提示: cannot execute "/etc/init.d/powerfail"
这个就是本文要解决的最后一个配置环节了,接着往下:
修改/etc/inittab
找到
# What to do when the power fails/returns.
注释pf, pn, po三行
再增加一行:
pf::powerfail:/sbin/shutdown -h now "Power Failure; System Shutting Down"