SHARE
TWEET

BOPM start, stop and restart bash script

MartyniP Jun 22nd, 2011 204 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. PID_FILE="/home/technoid/bopm/bopm.pid"
  3. PID_BACKUP="/home/technoid/bopm/bopm.pid.bak"
  4.  
  5. if [ "$1" = "start" ] ; then
  6.         echo "Starting BOPM"
  7.         if [ -r $PID_FILE ] ; then
  8.                 mv -f $PID_FILE $PID_BACKUP
  9.         fi
  10.         /home/technoid/bopm/bin/bopm
  11. elif [ "$1" = "stop" ] ; then
  12.         echo "Stopping BOPM"
  13.         kill -9 `cat $PID_FILE`
  14. elif [ "$1" = "restart" ] ; then
  15.         echo "Restarting BOPM"
  16.         kill -9 `cat $PID_FILE`
  17.         if [ -r $PID_FILE ] ; then
  18.                 mv -f $PID_FILE $PID_BACKUP
  19.         fi
  20.         /home/technoid/bopm/bin/bopm
  21.  
  22. else
  23.         echo "Usage: bopm start|stop|restart"
  24. fi
RAW Paste Data
Want to get better at Bash?
Learn to code Bash in 2017
Top