ping -c 1 192.168.3.1 > /dev/null
ret=$?
if [ $ret -eq 0 ]
then
echo ' UPS Power OK ! '
else
echo ' UPS Power maybe off, checking again after 3 minutes ! '
sleep 180
/usr/sbin/TG500-2.sh
fi
2、继续在/usr/sbin/下建立TG500-2.sh文件,内容如下:
#!/bin/sh
ping -c 1 192.168.1.1 > /dev/null
ret=$?
if [ $ret -eq 0 ]
then
echo ' UPS Power OK ! '
else
echo ' UPS Power off, shut down NAS ! '
/sbin/poweroff
fi