Cara Membuat Server Auto Shutdown Dengan Trigger Ping
IP_LIST=’192.168.0.1′
ALIVE=0
for IP in $IP_LIST; do
ping -q -c1 -w5 $IP
if [ $? -eq 0 ]; then
ALIVE=1
echo “$IP is alive: $(date)” >> /root/shutdown.log
break
fi
done
if [ $ALIVE -eq 0 ]; then
echo “***ShutDown*** $(date)” >> /root/shutdown.log
echo “###########################” >> /root/shutdown.log
/sbin/shutdown -h now
fi
Tidak ada komentar:
Posting Komentar
Tinggalkan komentar anda disini.