Using ups to make your box auto shutdown

作者: shaneZhang 分类: 互联网技术 发布时间: 2023-01-18 15:07
ups_check.sh

#!/bin/bash
MonitorIP=119.29.29.29
#接在市电上,需要一直保持开机状态的设备地址,如MonitorIP使用的是路由器地址网关地址192.168.81.1
DelayTime=300s
#关机等待时间1分钟60s,2分钟120s,3分钟180s
ping -c 1 $MonitorIP > /dev/null
ret=$?
if [ $ret -eq 0 ]
then
echo ' AC Power OK ! '
else
echo ' AC Power maybe off, checking again after 5 minutes ! '
sleep $DelayTime
ping -c 1 $MonitorIP > /dev/null
ret=$?
if [ $ret -eq 0 ]
then
echo ' Check again, AC Power OK ! '
else
echo 'poweroff'

本页面支持繁体中文友好显示:Using ups to make your box auto shutdown

如果觉得我的文章对您有用,请随意打赏。如果有其他问题请联系博主QQ(909491009)或者下方留言!

发表回复