#!/bin/sh while ping -c 1 10.1.1.1 > /dev/null [ $? -eq 0 ]; do #echo ' AC Power OK ! ' >> /vmfs/volumes/磁盘名/ups/ups.log;date >> /vmfs/volumes/磁盘名/ups/ups.log sleep 180 done echo' AC Power maybe off, checking again after 3 minutes ! ' >> /vmfs/volumes/磁盘名/ups/ups.log;date >> /vmfs/volumes/磁盘名/ups/ups.log sleep 60 ping -c 1 10.1.1.1 > /dev/null if [ $? -eq 0 ] then echo' Checkagain, AC Power OK ! ' >> /vmfs/volumes/磁盘名/ups/ups.log;date >> /vmfs/volumes/磁盘名/ups/ups.log else echo' AC Power is already off, shut down NAS Now! ' >> /vmfs/volumes/磁盘名/ups/ups.log;date >> /vmfs/volumes/磁盘名/ups/ups.log /bin/shutdown.sh halt fi