#! /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="/opt/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