thin wrapper
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
# 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/listener.pid" | |
test "$THIN_LOG" || THIN_LOG="./log/listener.log" | |
test "$THIN_ADDY" || THIN_ADDY="0.0.0.0" | |
# force defaults as such | |
# | |
#RACK_ENV="development" | |
#THIN_PORT="4321" | |
#THIN_PID="./log/listener.pid" | |
#THIN_LOG="./log/listener.log" | |
# vim: set filetype=sh |
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
#!/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/packages.pid" | |
test "$THIN_LOG" || THIN_LOG="./log/packages.log" | |
DAEMONIZE="--log $THIN_LOG --daemonize" | |
test "$DEVELOP" && DAEMONIZE="" | |
test "$DEBUG" && set -x | |
if ! test "$1" | |
then | |
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 | |
fi | |
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