Page MenuHomePhabricator
Paste P5752

(An Untitled Masterwork)
ActivePublic

Authored by Dzahn on Jul 14 2017, 11:05 PM.
Tags
None
Referenced Files
F8762156:
Jul 14 2017, 11:05 PM
Subscribers
None
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=gunicorn
DESC="Gunicorn workers"
HELPER=/usr/sbin/gunicorn-debian
PID_DIR=/var/run/gunicorn
LOG_DIR=/var/log/gunicorn
CONF_DIR=/etc/gunicorn.d
test -x $HELPER || exit 0
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
. /lib/lsb/init-functions
Action() {
mkdir -p $PID_DIR
log_daemon_msg "$1"
shift
if $HELPER \
--conf-dir=$CONF_DIR \
--pid-dir=$PID_DIR \
--log-dir=$LOG_DIR \
"$@"
then
log_success_msg
else
log_failure_msg
exit 1
fi
}
action="$1"
shift
case "$action" in
start)
Action "Starting $DESC" start "$@"
;;
stop)
Action "Stopping $DESC" stop "$@"
;;
reload)
Action "Reloading $DESC" reload "$@"
;;
restart|force-reload)
$0 stop "$@"
$0 start "$@"
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload} [configs]" >&2
exit 1
;;
esac
exit 0