64 lines
1.2 KiB
Bash
64 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: phyre
|
|
# internal nginx
|
|
# Required-Start: $local_fs $remote_fs $network $syslog
|
|
# Required-Stop: $local_fs $remote_fs $network $syslog
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: starts the phyre control panel
|
|
# Description: starts nginx using start-stop-daemon
|
|
### END INIT INFO
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
NGINX_DAEMON=/usr/local/phyre/nginx/sbin/phyre-nginx
|
|
NGINX_NAME=phyre-nginx
|
|
NGINX_DESC=phyre-nginx
|
|
NGINX_PID=/run/phyre-nginx.pid
|
|
NGINX_CONF=/usr/local/phyre/nginx/conf/nginx.conf
|
|
|
|
set -e
|
|
|
|
start_nginx() {
|
|
start-stop-daemon --start --quiet --pidfile $NGINX_PID \
|
|
--retry 5 --exec $NGINX_DAEMON --oknodo
|
|
}
|
|
|
|
stop_nginx() {
|
|
start-stop-daemon --stop --quiet --pidfile $NGINX_PID \
|
|
--retry 5 --oknodo --exec $NGINX_DAEMON
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
|
|
start_nginx
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop_nginx
|
|
|
|
;;
|
|
|
|
restart | force-reload | reload | configtest | testconfig)
|
|
|
|
stop_nginx
|
|
sleep 1
|
|
start_nginx
|
|
|
|
;;
|
|
|
|
status)
|
|
status_of_proc -p $NGINX_PID "$NGINX_DAEMON" phyre-nginx
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: phyre {start|stop|restart|status}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|