Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # chkconfig: 345 20 80
- # description: Play start/shutdown script
- # processname: play
- #
- # Instalation:
- # copy file to /etc/init.d
- # chmod +x /etc/init.d/play
- # chkconfig --add /etc/init.d/play
- # chkconfig play on
- #
- # Usage: (as root)
- # service play start
- # service play stop
- # service play status
- #
- # Remember, you need python 2.6 to run the play command, it doesn't come standard with RedHat/Centos 5.5
- # Also, you may want to temporarily remove the >/dev/null for debugging purposes
- # Path to play install folder
- PLAY_HOME=/path/to/play_home
- PLAY=$PLAY_HOME/play
- # Path to the JVM
- JAVA_HOME=/path/to/java_home
- export JAVA_HOME
- # User running the Play process
- USER=apache
- # Path to the application
- APPLICATION_PATH=/path/to/application
- APPLICATION_MODE=prod
- #APPLICATION2_PATH=/path/to/application2
- #APPLICATION_MODE=prod
- # source function library
- . /etc/init.d/functions
- RETVAL=0
- start() {
- echo -n "Starting Play service: "
- su -s /bin/sh $USER -c "${PLAY} start ${APPLICATION_PATH} --%${APPLICATION_MODE} >/dev/null"
- RETVAL=$?
- # You may want to start more applications as follows
- # [ $RETVAL -eq 0 ] && su -s /bin/sh $USER -c "${PLAY} start ${APPLICATION2_PATH} --%${APPLICATION_MODE} > /dev/null"
- # RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- echo_success
- else
- echo_failure
- fi
- echo
- }
- stop() {
- echo -n "Shutting down Play service: "
- ${PLAY} stop ${APPLICATION_PATH} > /dev/null
- # ${PLAY} stop ${APPLICATION2_PATH} > /dev/null
- RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- echo_success
- else
- echo_failure
- fi
- echo
- }
- status() {
- ${PLAY} status ${APPLICATION_PATH}
- #${PLAY} status ${APPLICATION2_PATH}
- RETVAL=$?
- }
- clean() {
- rm -f ${APPLICATION_PATH}/server.pid
- #rm -f ${APPLICATION2_PATH}/service.pid
- }
- case "$1" in
- start)
- clean
- start
- ;;
- stop)
- stop
- ;;
- restart|reload)
- stop
- sleep 10
- start
- ;;
- status)
- status
- ;;
- clean)
- clean
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|status}"
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement