]> git.proxmox.com Git - pve-firewall.git/blame - debian/pve-firewall.init
cleanup firewall service implementation
[pve-firewall.git] / debian / pve-firewall.init
CommitLineData
2c5486ff
DM
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: pve-firewall
5# Required-Start: $remote_fs $network pvefw-logger pve-cluster
6# Required-Stop: $remote_fs $network pvefw-logger pve-cluster
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
e2beb7aa 9# Short-Description: Proxmox VE firewall
2c5486ff
DM
10### END INIT INFO
11
12. /lib/lsb/init-functions
13
14PATH=/sbin:/bin:/usr/bin:/usr/sbin
e2beb7aa
DM
15NAME=pve-firewall
16DAEMON=/usr/sbin/$NAME
17DESC="Proxmox VE firewall"
18PIDFILE=/var/run/$NAME.pid
2c5486ff 19
e2beb7aa
DM
20# Exit if the package is not installed
21[ -x "$DAEMON" ] || exit 0
22
23START_FIREWALL=yes
24
25# Read configuration variable file if it is present
26[ -r /etc/default/$NAME ] && . /etc/default/$NAME
27
28[ "$START_FIREWALL" = "yes" ] || exit 0
29
30# Load the VERBOSE setting and other rcS variables
31. /lib/init/vars.sh
32
33# Define LSB log_* functions.
34# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
35# and status_of_proc is working.
36. /lib/lsb/init-functions
2c5486ff
DM
37
38# avoid warnings about uninstalled locales
39export LC_ALL="C"
40
41case "$1" in
e2beb7aa
DM
42 start)
43 log_daemon_msg "Starting $DESC" "$NAME"
44 $DAEMON start
45 log_end_msg $?
46 ;;
47 stop)
48 log_daemon_msg "Stopping $DESC" "$NAME"
49 $DAEMON stop
50 log_end_msg $?
51 ;;
52 status)
53 $DAEMON status
54 ;;
55 reload|restart|force-reload)
56 log_daemon_msg "Restarting $DESC" "$NAME"
57 if ( [ -e $PIDFILE ] && kill -0 `cat $PIDFILE`) then
58 start-stop-daemon --stop --quiet --pidfile $PIDFILE --signal HUP
59 else
60 $DAEMON start
61 fi
62 log_end_msg $?
63 ;;
64 *)
65 N=/etc/init.d/$NAME
66 echo "Usage: $N {start|stop|status|restart|force-reload}"
67 exit 1
68 ;;
2c5486ff
DM
69esac
70
71exit 0