Created
December 21, 2017 10:33
-
-
Save datenimperator/c55da22c118610d9fab07355de19c488 to your computer and use it in GitHub Desktop.
Passenger init script
This file contains 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 | |
### BEGIN INIT INFO | |
# Provides: passenger in standalone | |
# Required-Start: $network $syslog | |
# Should-Start: $mysql | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# X-Interactive: true | |
# Short-Description: Start/stop rails web site | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
PASSENGER="/usr/local/bin/passenger" | |
PORT=80 | |
ENVIRONMENT="production" | |
APP_DIR="/var/www/current" | |
CMD="$PASSENGER start -p $PORT -e $ENVIRONMENT -d --user www-data" | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
echo "Starting standalone passenger" | |
cd $APP_DIR | |
$CMD | |
;; | |
stop) | |
echo "Stopping standalone passenger" | |
cd $APP_DIR | |
$PASSENGER stop -p $PORT | |
;; | |
restart) | |
echo "Restarting standalone passenger" | |
cd $APP_DIR | |
$PASSENGER stop -p $PORT | |
$CMD | |
;; | |
*) | |
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