Guest User

RhodeCode script

a guest
Apr 3rd, 2013
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ########################################
  2. #### THIS IS A DEBIAN INIT.D SCRIPT ####
  3. ########################################
  4. ### BEGIN INIT INFO
  5. # Provides:          rhodecode          
  6. # Required-Start:    $all
  7. # Required-Stop:     $all
  8. # Default-Start:     2 3 4 5
  9. # Default-Stop:      0 1 6
  10. # Short-Description: starts instance of rhodecode
  11. # Description:       starts instance of rhodecode using start-stop-daemon
  12. ### END INIT INFO
  13. APP_NAME="rhodecode"
  14. APP_HOMEDIR="/var/www"
  15. APP_PATH="$APP_HOMEDIR/$APP_NAME"
  16. CONF_NAME="production.ini"
  17. PID_PATH="$APP_PATH/$APP_NAME.pid"
  18. LOG_PATH="$APP_PATH/$APP_NAME.log"
  19. PYTHON_PATH="/var/www/rhodecode-venv"
  20. RUN_AS="www-data"
  21. DAEMON="$PYTHON_PATH/bin"
  22. DAEMON_OPTS="paster serve --daemon \
  23. --user=$RUN_AS \
  24. --group=$RUN_AS \
  25. --pid-file=$PID_PATH \
  26. --log-file=$LOG_PATH  $APP_PATH/$CONF_NAME"
  27. start() {
  28.   echo "Starting $APP_NAME"
  29.   PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \
  30.       --start --quiet \
  31.       --pidfile $PID_PATH \
  32.       --user $RUN_AS \
  33.       --exec $DAEMON -- $DAEMON_OPTS
  34. }
  35. stop() {
  36.   echo "Stopping $APP_NAME"
  37.   start-stop-daemon -d $APP_PATH \
  38.       --stop --quiet \
  39.       --pidfile $PID_PATH || echo "$APP_NAME - Not running!"
  40.   if [ -f $PID_PATH ]; then
  41.     rm $PID_PATH
  42. fi
  43. }
  44. case "$1" in
  45.   start)
  46.     start
  47.     ;;
  48.   stop)
  49.     stop
  50.     ;;
  51.   restart)
  52.     echo "Restarting $APP_NAME"
  53.     ### stop ###
  54.     stop
  55.     wait
  56.     ### start ###
  57.     start
  58.     ;;
  59.   *)
  60.     echo "Usage: $0 {start|stop|restart}"
  61.     exit 1
  62. esac
RAW Paste Data