Skip to content

Instantly share code, notes, and snippets.

@mrinterweb
Created November 23, 2010 22:45
Show Gist options
  • Save mrinterweb/712690 to your computer and use it in GitHub Desktop.
Save mrinterweb/712690 to your computer and use it in GitHub Desktop.
/etc/init.d/thin
#!/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