Skip to content

Instantly share code, notes, and snippets.

@eduardodeoh
Created November 1, 2012 03:56
Show Gist options
  • Save eduardodeoh/3991596 to your computer and use it in GitHub Desktop.
Save eduardodeoh/3991596 to your computer and use it in GitHub Desktop.
Init Script for Gunicorn for Graphite
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GitLab git repository management
# Description: GitLab git repository management
### END INIT INFO
APP_ROOT="/opt/graphite/webapp/graphite"
NAME="gunicorn-graphite"
DESC="Gunicorn Workers"
PID="/opt/graphite/storage/graphite-webapp.pid"
APP="graphite-web"
USER="www-data"
GROUP="www-data"
BIND="127.0.0.1:8000"
ACCESS_LOG="/opt/graphite/storage/log/webapp/access.log"
ERROR_LOG="/opt/graphite/storage/log/webapp/error.log"
WORKERS="1"
# Name of executable daemon
NAME=gunicorn-graphite
DESC=gunicorn-graphite
# Path to Executable
DAEMON=/usr/bin/gunicorn_django
DAEMON_OPTS="--user=$USER --group=$GROUP --bind=$BIND --access-logfile=$ACCESS_LOG --error-logfile=$ERROR_LOG --pid=$PID --workers=$WORKERS --name=$APP --preload --daemon"
case "$1" in
start)
CD_TO_APP_DIR="cd $APP_ROOT"
START_RESQUE_PROCESS="./resque.sh"
echo -n "Starting $DESC: "
$CD_TO_APP_DIR && $DAEMON $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
kill -QUIT `cat $PID`
echo "$NAME."
;;
*)
echo "Usage: $NAME {start|stop}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment