|
# tar zxvf genpower-1.0.2.tgz # cd genpower-1.0.2
/* Feb/05/2001 Tripplite Omnismart 450 PNP Jhon H. CaicedoO.S.S.O */ {6, "omnismart-pnp", {TIOCM_RTS,1}, {TIOCM_RTS,1}, 5, {TIOCM_CTS,0}, {TIOCM_CAR,0}, {0,0}}, /* Weli UPS */ {7, "weli", {TIOCM_RTS,0}, {TIOCM_DTR,1}, 5, {TIOCM_CTS,0}, {TIOCM_CAR,0}, {0,0}}, {-1, NULL}
# cd genpower-1.0.2 # make all # make install
# cd genpower-1.0.2 # ./gentest -r /dev/cua0 --------------- DTR = Cleared RTS = Set CAR = High (*) CTS = High (*) DSR = Low ( ) RNG = Low ( ) --------------- DTR = Cleared RTS = Set CAR = Low (*) CTS = Low (*) DSR = Low ( ) RNG = Low ( )
# ln -s /dev/cua0 /dev/UPS
# When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. # pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" pf::powerfail:/etc/genpowerfail start # If power was restored before the shutdown kicked in, cancel it. # pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" pr:12345:powerokwait:/etc/genpowerfail stop
# ADD support for the UPS echo "Starting genpowerd daemon..." if [ -x /sbin/genpowerd ]; then /sbin/genpowerd /dev/UPS weli fi
# See if this is a powerfail situation (genpowerd). if [ -r /etc/upsstatus ]; then status=`head -1 /etc/upsstatus` # Kill power if needed if [ $status != "OK" ]; then echo "Killing Power..." sleep 5 genpowerd -k /dev/UPS weli fi fi # Now halt or reboot. echo "$message" if [ -f /fastboot ]; then echo "On the next boot fsck will be skipped." elif [ -f /forcefsck ]; then echo "On the next boot fsck will be forced." fi eval $command -i -d -p