Created
July 12, 2011 22:03
-
-
Save rchampourlier/1079091 to your computer and use it in GitHub Desktop.
SystemV service startup script for a Ruby On Rails app (redmine) with passenger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# chkconfig: - 86 14 | |
### BEGIN INIT INFO | |
# Provides: redmine | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# X-Interactive: true | |
# Short-Description: redmine (Rails app) provided through Passenger Standalone | |
### END INIT INFO | |
USER=www | |
RVM=rvm | |
RVM_GEMSET=ree@redmine | |
PASSENGER=passenger | |
ADDRESS=127.0.0.1 | |
PORT=3000 | |
ENVIRONMENT=production | |
APP="/var/www/railsapps/redmine" | |
APPNAME="redmine" | |
SET_PATH="cd $APP; $RVM use $RVM_GEMSET;" | |
CMD="$SET_PATH $PASSENGER start -a $ADDRESS -p $PORT -e $ENVIRONMENT -d" | |
CMD_STOP="$SET_PATH $PASSENGER stop -p $PORT" | |
case "$1" in | |
start) | |
echo "Starting $APP_NAME passenger" | |
echo $CMD | |
su - $USER -c "$CMD" | |
;; | |
stop) | |
echo "Stopping $APP_NAME passenger" | |
cd $APP | |
su - $USER -c "$CMD_STOP" | |
;; | |
*) | |
echo "Usage: $0 start|stop" >&2 | |
exit 3 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment