3 # Provides: sipb-xen-iptables
4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: sipb-xen iptables rules
12 # Author: SIPB Xen Project <sipb-xen@mit.edu>
16 # PATH should only include /usr/* if it runs after the mountnfs.sh script
17 PATH=/sbin:/usr/sbin:/bin:/usr/bin
18 DESC="Load the sipb-xen iptables rules"
19 NAME=sipb-xen-iptables
20 RULES=/usr/share/sipb-xen-iptables/iptables.rules
22 # Read configuration variable file if it is present
23 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
25 # Load the VERBOSE setting and other rcS variables
28 # Define LSB log_* functions.
29 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
30 . /lib/lsb/init-functions
33 # Function that starts the daemon/service
38 # 0 if daemon has been started
39 # 1 if daemon was already running
40 # 2 if daemon could not be started
41 for i in /usr/share/sipb-xen-iptables/iptables.rules
42 do mako-render $i.mako > $i
45 /sbin/iptables-restore < $RULES
49 # Function that stops the daemon/service
54 # 0 if daemon has been stopped
55 # 1 if daemon was already stopped
56 # 2 if daemon could not be stopped
57 # other if a failure occurred
63 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
66 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
67 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
71 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
74 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
75 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
80 # If do_reload() is not implemented then leave this commented out
81 # and leave 'force-reload' as an alias for 'restart'.
83 #log_daemon_msg "Reloading $DESC" "$NAME"
89 # If the "reload" option is implemented then remove the
90 # 'force-reload' alias
92 log_daemon_msg "Restarting $DESC" "$NAME"
99 1) log_end_msg 1 ;; # Old process is still running
100 *) log_end_msg 1 ;; # Failed to start
110 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
111 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2