Advertisement
Guest User

OpenCHAT Start/Stop script

a guest
Feb 23rd, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.91 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #Please note that your main config file (OpenCHAT.conf)
  4. #must be located in /etc to make this script work from any folder
  5. #(and of course this script itself must be located in your PATH)
  6.  
  7. #This is the folder where your OpenCHAT.jar and other conf files are located
  8. installfolder=/path/to/OpenCHAT
  9.  
  10.  
  11. if [ $# -eq 0 -o $# -gt 1 ]; then
  12.     echo "Usage : openchat [stop/start]"
  13. else
  14.     if [ $1 = "start" ]; then
  15.         if [ -f $installfolder/OpenCHAT.pid ]; then
  16.             echo "OpenCHAT is already started"
  17.         else
  18.             java -jar $installfolder/OpenCHAT.jar >> $installfolder/OpenCHAT.logs &
  19.  
  20.             echo $! > $installfolder/OpenCHAT.pid
  21.         fi
  22.     elif [ $1 = "stop" ]; then
  23.         if [ -f $installfolder/OpenCHAT.pid ]; then
  24.             pid=`cat $installfolder/OpenCHAT.pid`
  25.             kill -9 $pid
  26.             rm $installfolder/OpenCHAT.pid
  27.         else
  28.             echo "OpenCHAT is not started yet"
  29.         fi
  30.     else
  31.         echo "Usage : openchat [stop/start]"
  32.     fi
  33. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement