操作系统:Ubuntu 20.04 NUT:2.7.4-11ubuntu4 amd64
有没有办法设置 upsmon.conf(或其他非编程方式),以便 SHUTDOWNCMD 命令基于某个表达式?例如:我希望操作系统在切换到仅 UPS 电源(即市电故障)后 x 分钟内正常关机。当前行为似乎只有一种方法,即在 UPS 报告“电池电量低”情况后关机,但我希望在该情况发生之前就关机。
答案1
我认为这是一个重要的问题,特别是在多用户环境中。
很高兴知道默认为 5 秒它非常短。
使用 FINALDELAY 配置指令upsmon配置文件。 用法:
最终延迟 秒
来自手册页:
When running in master mode, upsmon waits this long after sending the NOTIFY_SHUTDOWN to warn the users. After the timer elapses, it then runs your
SHUTDOWNCMD. By default this is set to 5 seconds.
If you need to let your users do something in between those events, increase this number. Remember, at this point your UPS battery is almost depleted, so
don’t make this too big.
Alternatively, you can set this very low so you don’t wait around when it’s time to shut down. Some UPSes don’t give much warning for low battery and will
require a value of 0 here for a safe shutdown.