1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: graphite-api
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Graphite-API service
### END INIT INFO
DESC="Graphite-API service"
DAEMON=/usr/bin/gunicorn3
NAME=graphite-api
PIDFILE="/run/$NAME.pid"
USER=_graphite
GROUP=_graphite
DAEMON_ARGS="--name=$NAME"
DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/graphite-api/gunicorn.log"
DAEMON_ARGS="$DAEMON_ARGS --user=$USER --group=$GROUP"
DAEMON_ARGS="$DAEMON_ARGS --daemon --pid=$PIDFILE"
DAEMON_ARGS="$DAEMON_ARGS graphite_api.app:app"
do_stop_cmd_override() {
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile ${PIDFILE} --exec /usr/bin/python3
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \
--pidfile ${PIDFILE} --exec /usr/bin/python3
[ "$?" = 2 ] && return 2
rm -f $PIDFILE
return $RETVAL
}
|