Skip to content

Instantly share code, notes, and snippets.

Last active Oct 11, 2015
What would you like to do?
thin wrapper
# Directory pathing context should be that of the thin
# init script sourcing this file, not this file itself.
# allow for overides as such
test "$RACK_ENV" || RACK_ENV="production"
test "$THIN_PORT" || THIN_PORT="4321"
test "$THIN_PID" || THIN_PID="./log/"
test "$THIN_LOG" || THIN_LOG="./log/listener.log"
test "$THIN_ADDY" || THIN_ADDY=""
# force defaults as such
# vim: set filetype=sh
#!/usr/bin/env bash
# source config if present
test -f ./config/thinrc && source ./config/thinrc
# set up primary defaults
test "$RACK_ENV" || RACK_ENV="production"
test "$THIN_PORT" || THIN_PORT="8000"
test "$THIN_PID" || THIN_PID="./log/"
test "$THIN_LOG" || THIN_LOG="./log/packages.log"
DAEMONIZE="--log $THIN_LOG --daemonize"
test "$DEBUG" && set -x
if ! test "$1"
echo "Usage: listener start|stop|restart"
echo " "
echo "Takes the following overides as environemnt variables:"
echo " "
echo " RACK_ENV :: default $RACK_ENV"
echo " THIN_PORT :: default $THIN_PORT"
echo " THIN_PID :: default $THIN_PID"
echo " THIN_LOG :: default $THIN_LOG"
echo " "
echo "Takes config file as './config/thinrc' with overides above. "
echo " "
exit 0
RACK_ENV=$RACK_ENV bundle exec thin --port $THIN_PORT --pid $THIN_PID $DAEMONIZE $1
# vim: set filetype=sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment