Advertisement
Guest User

basskozz

a guest
Feb 4th, 2009
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/bin/sh
  2. ###
  3. # 2/3/09
  4. # adv-shutdown.sh
  5. # Advanced Shutdown Script
  6. # Ref - http://basskozz.wordpress.com/2009/02/03/advanced-shutdown-script-powersaving/
  7. ###
  8.  
  9. IP_LIST='192.168.1.101 192.168.1.102 192.168.1.103 192.168.1.104'
  10.  
  11. ALIVE=0
  12. for IP in $IP_LIST; do
  13. ping -q -c1 -w5 $IP
  14. if [ $? -eq 0 ]; then
  15. ALIVE=1
  16. echo "$IP is alive: $(date)" >> /home/user/scripts/adv-shutdown.log
  17. break
  18. fi
  19. done
  20.  
  21. if [ $ALIVE -eq 0 ]; then
  22. echo "***ShutDown*** $(date)" >> /home/user/scripts/adv-shutdown.log
  23. echo "###########################" >> /home/user/scripts/adv-shutdown.log
  24. /sbin/shutdown -h now
  25. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement