LB - система работает от севшей батареи (low battery)
Настройка upssched (планировщик):
файл /etc/nut/upssched.conf
CMDSCRIPT /etc/nut/cmd.sh
PIPEFN /tmp/upspipe
LOCKFN /tmp/upslock
AT COMMBAD * EXECUTE commbad
AT COMMOK * EXECUTE commok
AT NOCOMM * EXECUTE nocomm
AT ONBATT * EXECUTE powerout
AT ONBATT * START-TIMER shutdownnow 90
AT LOWBATT * EXECUTE shutdowncritical
AT ONLINE * CANCEL-TIMER shutdownnow
AT ONLINE * EXECUTE powerup
AT ONBATT * START-TIMER shutdownnow 90 - при работе от батареи ждем 90 секунд и выполняем скрипт cmd.sh с аргументом shutdownnow.
Получение списка команд UPS
# upscmd -l mustek@localhost
Instant commands supported on UPS [mustek]:
beeper.toggle - Toggle the UPS beeper
load.off - Turn off the load immediately
load.on - Turn on the load immediately
shutdown.return - Turn off the load and return when power is back
shutdown.stayoff - Turn off the load and remain off
shutdown.stop - Stop a shutdown in progress
test.battery.start - Start a battery test
test.battery.start.deep - Start a deep battery test
test.battery.start.quick - Start a quick battery test
test.battery.stop - Stop the battery test
#!/bin/sh
case $1 in
commbad)
logger "UPS communications failure"
;;
commok)
logger "UPS communications restored"
;;
nocomm)
logger "UPS communications cannot be established"
;;
powerout)
logger "UPS on battery. Shutdown in 90 seconds...."
upscmd -u upsmon -p password mustek@localhost shutdown.return
;;
shutdownnow)
logger "UPS has been on battery for 120 seconds. Starting orderly shutdown"
upsmon -c fsd
;;
shutdowncritical)
logger "UPS battery level CRITICAL. Shutting down NOW!!!!"
upsmon -c fsd
;;
powerup)
logger "UPS on line. Shutdown aborted."
upscmd -u upsmon -p pass mustek@localhost shutdown.stop
;;
*)
logger "Unrecognized command: $1"
;;
esac
Если все работает правильно, ОС завершит работу, компьютер будет принудительно отключен от электросети (UPS выключится). После возобновление подачи питания, он автоматически подаст питание на компьютер.
При копировании материалов ссылка на сайт обязательна