Skip to content

Instantly share code, notes, and snippets.

@hydra1983
Created November 15, 2012 08:27
Show Gist options
  • Save hydra1983/4077381 to your computer and use it in GitHub Desktop.
Save hydra1983/4077381 to your computer and use it in GitHub Desktop.
geminabox startup scripts
#!/bin/bash
### BEGIN INIT INFO
# Provides: geminabox
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Geminabox.
# Description: Start the Geminabox service.
### END INIT INFO
if [ -s "$HOME/.rvm/scripts/rvm" ] ; then
source "$HOME/.rvm/scripts/rvm"
elif [ -s "/usr/local/rvm/scripts/rvm" ] ; then
source "/usr/local/rvm/scripts/rvm"
else
exit 0
fi
rvm use 1.9.3
SCRIPT_NAME=/etc/init.d/geminabox
THIN_CONFIG=/etc/geminabox/config.yml
PID_FILE=/var/run/geminabox.pid
LOG_FILE=/var/log/geminabox/thin.log
DAEMON="bundle exec thin -d"
GEMINABOX_HOME=/var/lib/geminabox
GEMINABOX_CONFIG=/etc/geminabox/config.ru
cd $GEMINABOX_HOME
case "$1" in
start)
$DAEMON -l $LOG_FILE -P $PID_FILE -C $THIN_CONFIG -R $GEMINABOX_CONFIG $1
;;
stop)
$DAEMON -l $LOG_FILE -P $PID_FILE -C $THIN_CONFIG -R $GEMINABOX_CONFIG $1
;;
restart)
$DAEMON -l $LOG_FILE -P $PID_FILE -C $THIN_CONFIG -R $GEMINABOX_CONFIG $1
;;
*)
echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment