shell实现UPS(断网自动关机)
#!/bin/bash destination_ip=192.168.2.1 if ! ping -c1 $destination_ip &>/dev/null then echo "$destination_ip is offline." shutdown fi
ping 一个地址,如果不通,就关机。
放入crontab 定时任务,每分钟执行一下就好了。
最近又整了个X86平板,做PVE,内置电池,但是linux又不想深入研究电池管理,就直接断网关机吧。
其他的linux服务器,也是接在UPS后面,但是UPS确实业余,只有一个USB口管理,多余的服务器,也只能断网关机了。
主路由不接UPS就好了。

浙公网安备 33010602011771号