Advertisement
yannsimon

linux init script for playframework 2

Jul 25th, 2012
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.05 KB | None | 0 0
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          playframework
  4. # Required-Start:    $local_fs $remote_fs $network $syslog
  5. # Required-Stop:     $local_fs $remote_fs $network $syslog
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      0 1 6
  8. # Short-Description: Start/Stop playframework
  9. ### END INIT INFO
  10. #
  11. #source some script files in order to set and export environmental variables
  12. #as well as add the appropriate executables to $PATH
  13.  
  14. PLAYFRAMEWORK_HOME='/opt/playframework/'
  15. export PIDFILE='/opt/playframework/RUNNING_PID'
  16. USER=playframework
  17. GROUP=nogroup
  18.  
  19. case "$1" in
  20.     start)
  21.         echo "Starting playframework"
  22.         START_CMD="${PLAYFRAMEWORK_HOME}/start -Dparam1=value1"
  23.         start-stop-daemon --start -p "${PIDFILE}" --quiet --background --chuid ${USER}:${GROUP} --exec /bin/bash -- ${START_CMD}
  24.         ;;
  25.     stop)
  26.         echo "Stopping playframework"
  27.         start-stop-daemon -K -p "${PIDFILE}" -u "${USER}" -R 30 ;;
  28.       *)
  29.         echo "Usage: /etc/init.d/playframework {start|stop}"
  30.         exit 1
  31.     ;;
  32. esac
  33.  
  34. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement