]> TLD Linux GIT Repositories - packages/shorewall.git/blob - shorewall.init
- rediffed
[packages/shorewall.git] / shorewall.init
1 #!/bin/sh
2 #
3 # shorewall             The Shoreline Firewall (Shorewall) Packet Filtering Firewall
4 #
5 # chkconfig:    2345 10 89
6 #
7 # description: Packet filtering firewall
8 #
9
10 # Source function library
11 . /etc/rc.d/init.d/functions
12 . /usr/share/shorewall/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17 # Check that networking is up
18 if is_yes "${NETWORKING}"; then
19         if [ ! -f /var/lock/subsys/network ]; then
20                 msg_network_down shorewall
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 start() {
28         if [ -f /var/lock/subsys/shorewall ]; then
29                 msg_already_running shorewall
30                 return
31         fi
32
33         msg_starting "Shorewall"
34         busy
35         /usr/sbin/shorewall -q start >/dev/null
36         RETVAL=$?
37         if [ $RETVAL -eq 0 ]; then
38                 ok
39                 touch /var/lock/subsys/shorewall
40         else
41                 fail
42         fi
43 }
44
45 stop() {
46         if [ ! -f /var/lock/subsys/shorewall ]; then
47                 msg_not_running shorewall
48                 return
49         fi
50
51         msg_stopping "Shorewall"
52         busy
53         /usr/sbin/shorewall stop >/dev/null
54         RETVAL=$?
55         if [ $RETVAL -eq 0 ]; then
56                 ok
57                 rm -f /var/lock/subsys/shorewall >/dev/null 2>&1
58         else
59                 fail
60         fi
61 }
62
63 # See how we were called
64 case "$1" in
65   start)
66         start
67         ;;
68   stop)
69         stop
70         ;;
71   status)
72         status shorewall
73         exec /usr/sbin/shorewall status
74         exit $?
75         ;;
76   restart)
77         stop
78         start
79         ;;
80   *)
81         msg_usage "$0 {start|stop|restart|status}"
82         exit 3
83 esac