X-Git-Url: https://git.proxmox.com/?p=pve-firewall.git;a=blobdiff_plain;f=debian%2Fpve-firewall.init;h=0c002a79a418ca2ef7c06fb7f49dbabb1becea42;hp=5e01d1e0cb3eafd152cede934a54c4414a60dc3e;hb=e2beb7aa9900c650ec69594a2f26cc2889908134;hpb=2c5486ffcae5f941e9cd44347cde8771562accfa;ds=sidebyside diff --git a/debian/pve-firewall.init b/debian/pve-firewall.init index 5e01d1e..0c002a7 100755 --- a/debian/pve-firewall.init +++ b/debian/pve-firewall.init @@ -6,43 +6,66 @@ # Required-Stop: $remote_fs $network pvefw-logger pve-cluster # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: PVE firewall +# Short-Description: Proxmox VE firewall ### END INIT INFO . /lib/lsb/init-functions PATH=/sbin:/bin:/usr/bin:/usr/sbin -PVEFW=/usr/sbin/pvefw -NAME=pvefw -DESC="PVE firewall" -PIDFILE=/var/run/pvefw-logger.pid +NAME=pve-firewall +DAEMON=/usr/sbin/$NAME +DESC="Proxmox VE firewall" +PIDFILE=/var/run/$NAME.pid -test -f $PVEFW || exit 0 +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +START_FIREWALL=yes + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +[ "$START_FIREWALL" = "yes" ] || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions # avoid warnings about uninstalled locales export LC_ALL="C" case "$1" in - start) - log_daemon_msg "Starting $DESC" "$NAME" - $PVEFW start - log_end_msg $? - ;; - stop) - log_daemon_msg "Stopping $DESC" "$NAME" - $PVEFW stop - log_end_msg $? - ;; - reload|restart|force-reload) - log_daemon_msg "Restarting $DESC" "$NAME" - $PVEFW update - log_end_msg $? - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|force-reload}" - exit 1 - ;; + start) + log_daemon_msg "Starting $DESC" "$NAME" + $DAEMON start + log_end_msg $? + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + $DAEMON stop + log_end_msg $? + ;; + status) + $DAEMON status + ;; + reload|restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + if ( [ -e $PIDFILE ] && kill -0 `cat $PIDFILE`) then + start-stop-daemon --stop --quiet --pidfile $PIDFILE --signal HUP + else + $DAEMON start + fi + log_end_msg $? + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|status|restart|force-reload}" + exit 1 + ;; esac exit 0