btmash

loadwatcher.sh

Aug 18th, 2011
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. BASE_DIR=/path/to/base
  4. SCRIPT=$BASE_DIR/scripts/loadwatcher.php
  5. PID_FILE=/var/run/loadwatcher.pid
  6. EMAIL=btmash@gmail.com
  7.  
  8. # If there is an old process, kill it
  9. kill `cat $PID_FILE`
  10. # Make sure the file is clean
  11. rm -f $PID_FILE
  12.  
  13. cd $BASE_DIR
  14. nohup php $SCRIPT > /dev/null &
  15. PID=$!
  16.  
  17. echo $PID > $PID_FILE
RAW Paste Data