public
Created

/etc/init.d/thin

  • Download Gist
thin.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.