Advertisement
Guest User

Untitled

a guest
May 31st, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. #!/bin/bash
  2. # chkconfig: 345 20 80
  3. # description: Play start/shutdown script
  4. # processname: play
  5. #
  6. # Instalation:
  7. # copy file to /etc/init.d
  8. # chmod +x /etc/init.d/play
  9. # chkconfig --add /etc/init.d/play
  10. # chkconfig play on
  11. #
  12. # Usage: (as root)
  13. # service play start
  14. # service play stop
  15. # service play status
  16. #
  17. # Remember, you need python 2.6 to run the play command, it doesn't come standard with RedHat/Centos 5.5
  18. # Also, you may want to temporarily remove the >/dev/null for debugging purposes
  19.  
  20. # Path to play install folder
  21. PLAY_HOME=/path/to/play_home
  22. PLAY=$PLAY_HOME/play
  23.  
  24. # Path to the JVM
  25. JAVA_HOME=/path/to/java_home
  26. export JAVA_HOME
  27.  
  28. # User running the Play process
  29. USER=apache
  30.  
  31. # Path to the application
  32. APPLICATION_PATH=/path/to/application
  33. APPLICATION_MODE=prod
  34.  
  35. #APPLICATION2_PATH=/path/to/application2
  36. #APPLICATION_MODE=prod
  37.  
  38. # source function library
  39. . /etc/init.d/functions
  40. RETVAL=0
  41.  
  42. start() {
  43. echo -n "Starting Play service: "
  44. su -s /bin/sh $USER -c "${PLAY} start ${APPLICATION_PATH} --%${APPLICATION_MODE} >/dev/null"
  45. RETVAL=$?
  46.  
  47. # You may want to start more applications as follows
  48. # [ $RETVAL -eq 0 ] && su -s /bin/sh $USER -c "${PLAY} start ${APPLICATION2_PATH} --%${APPLICATION_MODE} > /dev/null"
  49. # RETVAL=$?
  50.  
  51. if [ $RETVAL -eq 0 ]; then
  52. echo_success
  53. else
  54. echo_failure
  55. fi
  56. echo
  57. }
  58. stop() {
  59. echo -n "Shutting down Play service: "
  60. ${PLAY} stop ${APPLICATION_PATH} > /dev/null
  61. # ${PLAY} stop ${APPLICATION2_PATH} > /dev/null
  62.  
  63. RETVAL=$?
  64.  
  65. if [ $RETVAL -eq 0 ]; then
  66. echo_success
  67. else
  68. echo_failure
  69. fi
  70. echo
  71. }
  72. status() {
  73. ${PLAY} status ${APPLICATION_PATH}
  74. #${PLAY} status ${APPLICATION2_PATH}
  75. RETVAL=$?
  76. }
  77. clean() {
  78. rm -f ${APPLICATION_PATH}/server.pid
  79. #rm -f ${APPLICATION2_PATH}/service.pid
  80. }
  81. case "$1" in
  82. start)
  83. clean
  84. start
  85. ;;
  86. stop)
  87. stop
  88. ;;
  89. restart|reload)
  90. stop
  91. sleep 10
  92. start
  93. ;;
  94. status)
  95. status
  96. ;;
  97. clean)
  98. clean
  99. ;;
  100. *)
  101. echo "Usage: $0 {start|stop|restart|status}"
  102. esac
  103. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement