Created
November 23, 2010 22:45
-
-
Save mrinterweb/712690 to your computer and use it in GitHub Desktop.
/etc/init.d/thin
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 | |
# This is a pretty bad, but effective workaround for starting thin as a service per application. | |
DAEMON=/usr/local/lib/ruby/gems/1.9.1/bin/thin | |
# DAEMON=/usr/local/bin/bundler thin | |
SCRIPT_NAME=/etc/init.d/thin | |
CONFIG_PATH=/etc/thin | |
# Exit if the package is not installed | |
[ -x "$DAEMON" ] || exit 0 | |
case "$1" in | |
start) | |
cd /srv/hub/current && bundle exec thin start -d -C /etc/thin/hub.yml | |
;; | |
stop) | |
cd /srv/hub/current && bundle exec thin stop -d -C /etc/thin/hub.yml | |
;; | |
restart) | |
cd /srv/hub/current && bundle exec thin restart -d -C /etc/thin/hub.yml | |
;; | |
*) | |
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