# 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