SHARE
TWEET

Untitled

a guest Oct 16th, 2011 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. do_it() {
  3.         echo "We are waiting on something. In this case we are waiting on 15 seconds to pass.";
  4.         sleep 15;
  5.         echo "THE DEED... IT IS DONE!";
  6.         echo "THE DEED IS DONE." > deed.log;
  7. }
  8.  
  9. did_dunnit() {
  10.         if [ -r deed.log ]; then
  11.                 echo "STATUS: It is done.";
  12.         else
  13.                 echo "STATUS: Still waiting.";
  14.         fi;
  15. }
  16.  
  17. case "$1" in
  18.         start)
  19.                 do_it&
  20.                 ;;
  21.         stop)
  22.                 killall do_it;
  23.                 rm deed.log;
  24.                 ;;
  25.         restart)
  26.                 $0 stop;
  27.                 sleep 1;
  28.                 rm deed.log;
  29.                 sleep 1;
  30.                 $0 start;
  31.                 ;;
  32.         status)
  33.                 did_dunnit;
  34.                 ;;
  35.         *)
  36.                 echo "Usage: $0 {start|stop|restart|status}";
  37.                 exit 1;
  38.                 ;;
  39. esac
  40.  
  41.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top