astara-appliance/scripts/etc/init.d/astara-router-api-server

48 lines
1.1 KiB
Bash
Executable File

#! /bin/sh
### BEGIN INIT INFO
# Provides: astara-router-api-server
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Astara Router API Server
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON="/usr/local/bin/gunicorn"
NAME="astara-router-api-server"
OPTIONS="--pythonpath /usr/local/share/astara -c /etc/astara_gunicorn_config astara_router.api.server:app"
PIDFILE=/var/run/gunicorn.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting astara-router-api-server" $NAME
start_daemon -p $PIDFILE $DAEMON $OPTIONS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping astara-router-api-server" $NAME
killproc -p $PIDFILE $DAEMON
log_end_msg $?
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/astara-router-api-server {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0