mirror of
https://github.com/cmur2/openvpn-status-web.git
synced 2024-11-10 14:56:15 +01:00
Add Debian 6 compatible init script
This commit is contained in:
parent
1cdcb69652
commit
d3b0327dcf
48
init.d/openvpn-status-web
Executable file
48
init.d/openvpn-status-web
Executable file
@ -0,0 +1,48 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: openvpn-status-web
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Handle openvpn-status-web
|
||||
### END INIT INFO
|
||||
|
||||
# your ruby interpreter
|
||||
DAEMON="/usr/bin/ruby"
|
||||
|
||||
# some unique name identifying your VPN
|
||||
VPN_NAME="vpn.example.org"
|
||||
|
||||
# path to the OpenVPN status log file
|
||||
STATUS_PATH="/var/log/openvpn-status.log"
|
||||
|
||||
# host and port for this daemon to listen on
|
||||
HOST="127.0.0.1"
|
||||
PORT="3000"
|
||||
|
||||
DAEMON_OPTS="/root/dev/openvpn-status-web/status.rb $VPN_NAME $STATUS_PATH $HOST $PORT"
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting openvpn-web-status for $VPN_NAME" "openvpn-web-status"
|
||||
start-stop-daemon --start --quiet --oknodo --make-pidfile --pidfile "/var/run/$VPN_NAME.pid" --background --exec $DAEMON -- $DAEMON_OPTS
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping openvpn-web-status for $VPN_NAME" "openvpn-web-status"
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile "/var/run/$VPN_NAME.pid"
|
||||
;;
|
||||
restart|force-reload)
|
||||
log_daemon_msg "Restarting openvpn-web-status for $VPN_NAME" "openvpn-web-status"
|
||||
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile "/var/run/$VPN_NAME.pid"
|
||||
start-stop-daemon --start --quiet --oknodo --make-pidfile --pidfile "/var/run/$VPN_NAME.pid" --background --exec $DAEMON -- $DAEMON_OPTS
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user