Skip to content

Instantly share code, notes, and snippets.

@bf4

bf4/server.sh

Created May 28, 2014
Embed
What would you like to do?
passenger server starting script
#!/usr/bin/env bash
# ./serve setup
# ./serve.sh start
# with jruby, can't daemonize so
# ./serve.sh start jruby
# TODO see if instead of checking for $2
# we can check if $RUBY_VERSION matches jruby
if [ ! -n "$1" ]
then
echo "Usage: ./serve.sh [start|stop|restart|status|setup]"
else
case "$1" in
setup)
which passenger &>/dev/null
if [ $? -eq 0 ]
then
echo 'passenger already installed'
else
echo 'installing pasenger'
gem install passenger
fi
;;
start) test -s '/Users'
# test -s '/var/web/current'
if [ $? -eq 1 ]
then
echo "starting app in production mode"
if [ ! -n "$2" ]
then
passenger start -d -e production
else
passenger start -e production
fi
else
echo "starting app in development mode"
if [ ! -n "$2" ]
then
passenger start -p 8080 -d -e development
else
passenger start -p 8080 -e development
fi
fi
;;
stop) test -s '/Users'
# test -s '/var/web/current'
if [ $? -eq 1 ]
then
echo "stopping app in production mode"
passenger stop
else
echo "stopping app in development mode"
passenger stop -p 8080
fi
;;
restart)
touch tmp/restart.txt
echo 'restarting app'
;;
status) passenger status
esac
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.