Created
April 4, 2014 11:54
-
-
Save mariuz/9972993 to your computer and use it in GitHub Desktop.
unicorn init script for a system wide rvm (app runs under ubuntu user and is configured with pid in tmp, can be tweaked)
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/sh | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: S 0 1 6 | |
# Short-Description: unicorn initscript | |
# Description: unicorn | |
### END INIT INFO | |
# start the app | |
cd /home/ubuntu/app | |
SCRIPT_NAME=/etc/init.d/unicorn | |
case "$1" in | |
start) | |
sudo su -c "source '/usr/local/rvm/scripts/rvm'; unicorn -c config/unicorn.rb -D -E production" ubuntu | |
;; | |
stop) | |
sudo su -c "kill -s QUIT `cat /tmp/unicorn.pid`" ubuntu | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2 | |
exit 3 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment