pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

pastebin - collaborative debugging tool View Help


Posted by basskozz on Wed 4 Feb 19:51
report abuse | download | new post

  1. #!/bin/sh
  2. ###
  3. # 2/4/09
  4. # adv-shutdown.sh
  5. # Advanced Shutdown Script
  6. # Ref - http://basskozz.wordpress.com/2009/02/04/advanced-shutdown-script-part-2-check-for-services/
  7. ###
  8.  
  9. SERVICE_LIST=’mysecurebackup’
  10. IP_LIST=’192.168.1.101 192.168.1.102 192.168.1.103 192.168.1.104‘
  11.  
  12. for SERVICE  in $SERVICE_LIST; do
  13.    if ps ax | grep -v grep | grep $SERVICE > /dev/null
  14.    then
  15.       echo “$SERVICE service is running: $(date)” >> /home/user/scripts/adv-shutdown.log
  16.       exit
  17.    else
  18.       echo “$SERVICE is NOT running: $(date)” >> /home/user/scripts/adv-shutdown.log
  19.    fi
  20. done
  21.  
  22. ALIVE=0
  23. for IP  in $IP_LIST; do
  24.    ping -q -c1 -w5 $IP
  25.    if [ $? -eq 0 ]; then
  26.       ALIVE=1
  27.       echo “$IP is alive: $(date)” >> /home/user/scripts/adv-shutdown.log
  28.       break
  29.    fi
  30. done
  31.  
  32. if [ $ALIVE -eq 0 ]; then
  33.    echo “***ShutDown***  $(date)” >> /home/user/scripts/adv-shutdown.log
  34.    echo “###########################” >> /home/user/scripts/adv-shutdown.log
  35.    /sbin/shutdown -h now
  36. fi

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post