annotate syslog2iptables.rc @ 25:caff690d7766

don't flush input chain, use -D option instead
author carl
date Wed, 01 Feb 2006 10:42:09 -0800
parents 0d65c3de34fd
children 28fec0c67646
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d76f9ff42487 initial coding
carl
parents: 7
diff changeset
1 # -- bash header installed by automake --
6
128cae6f3459 initial coding
carl
parents:
diff changeset
2 #
128cae6f3459 initial coding
carl
parents:
diff changeset
3 # syslog2iptables This script controls the syslog2iptables daemon.
128cae6f3459 initial coding
carl
parents:
diff changeset
4 #
128cae6f3459 initial coding
carl
parents:
diff changeset
5 #
128cae6f3459 initial coding
carl
parents:
diff changeset
6 # chkconfig: 2345 60 40
128cae6f3459 initial coding
carl
parents:
diff changeset
7 # description: syslog2iptables monitors syslog files, parses them, and update the iptables filters
128cae6f3459 initial coding
carl
parents:
diff changeset
8 # processname: syslog2iptables
128cae6f3459 initial coding
carl
parents:
diff changeset
9 # pidfile: /var/run/syslog2iptables.pid
128cae6f3459 initial coding
carl
parents:
diff changeset
10 # Source function library.
128cae6f3459 initial coding
carl
parents:
diff changeset
11 #
128cae6f3459 initial coding
carl
parents:
diff changeset
12 . /etc/rc.d/init.d/functions
128cae6f3459 initial coding
carl
parents:
diff changeset
13
128cae6f3459 initial coding
carl
parents:
diff changeset
14 # Source networking configuration.
128cae6f3459 initial coding
carl
parents:
diff changeset
15 . /etc/sysconfig/network
128cae6f3459 initial coding
carl
parents:
diff changeset
16
128cae6f3459 initial coding
carl
parents:
diff changeset
17 RETVAL=0
128cae6f3459 initial coding
carl
parents:
diff changeset
18 # See how we were called.
128cae6f3459 initial coding
carl
parents:
diff changeset
19 case "$1" in
128cae6f3459 initial coding
carl
parents:
diff changeset
20 start)
128cae6f3459 initial coding
carl
parents:
diff changeset
21 # Start daemons.
128cae6f3459 initial coding
carl
parents:
diff changeset
22 echo -n "Starting syslog2iptables: "
128cae6f3459 initial coding
carl
parents:
diff changeset
23 if [ ! -f /var/lock/subsys/syslog2iptables ]; then
10
5dfe0138b4f9 initial coding
carl
parents: 9
diff changeset
24 cd SYSCONFDIR # conf file is here
20
0d65c3de34fd add better logging
carl
parents: 10
diff changeset
25 SBINDIR/syslog2iptables -d 3
6
128cae6f3459 initial coding
carl
parents:
diff changeset
26 RETVAL=$?
10
5dfe0138b4f9 initial coding
carl
parents: 9
diff changeset
27 pid=`pidof -s SBINDIR/syslog2iptables`
6
128cae6f3459 initial coding
carl
parents:
diff changeset
28 if [ $pid ]
128cae6f3459 initial coding
carl
parents:
diff changeset
29 then
128cae6f3459 initial coding
carl
parents:
diff changeset
30 success "Starting syslog2iptables :"
128cae6f3459 initial coding
carl
parents:
diff changeset
31 touch /var/lock/subsys/syslog2iptables
128cae6f3459 initial coding
carl
parents:
diff changeset
32 echo
128cae6f3459 initial coding
carl
parents:
diff changeset
33 else
128cae6f3459 initial coding
carl
parents:
diff changeset
34 failure "Starting syslog2iptables:"
128cae6f3459 initial coding
carl
parents:
diff changeset
35 echo
128cae6f3459 initial coding
carl
parents:
diff changeset
36 fi
128cae6f3459 initial coding
carl
parents:
diff changeset
37 else
128cae6f3459 initial coding
carl
parents:
diff changeset
38 echo -n "already running! "
128cae6f3459 initial coding
carl
parents:
diff changeset
39 failure "syslog2iptables already running!"
128cae6f3459 initial coding
carl
parents:
diff changeset
40 echo
128cae6f3459 initial coding
carl
parents:
diff changeset
41 fi
128cae6f3459 initial coding
carl
parents:
diff changeset
42
128cae6f3459 initial coding
carl
parents:
diff changeset
43 ;;
128cae6f3459 initial coding
carl
parents:
diff changeset
44 stop)
128cae6f3459 initial coding
carl
parents:
diff changeset
45 # Stop daemons.
128cae6f3459 initial coding
carl
parents:
diff changeset
46 echo -n "Shutting down syslog2iptables: "
128cae6f3459 initial coding
carl
parents:
diff changeset
47 killproc syslog2iptables
128cae6f3459 initial coding
carl
parents:
diff changeset
48 RETVAL=$?
128cae6f3459 initial coding
carl
parents:
diff changeset
49 echo
128cae6f3459 initial coding
carl
parents:
diff changeset
50 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/syslog2iptables
128cae6f3459 initial coding
carl
parents:
diff changeset
51 ;;
128cae6f3459 initial coding
carl
parents:
diff changeset
52 restart|reload)
128cae6f3459 initial coding
carl
parents:
diff changeset
53 $0 stop
128cae6f3459 initial coding
carl
parents:
diff changeset
54 $0 start
128cae6f3459 initial coding
carl
parents:
diff changeset
55 RETVAL=$?
128cae6f3459 initial coding
carl
parents:
diff changeset
56 ;;
128cae6f3459 initial coding
carl
parents:
diff changeset
57 status)
128cae6f3459 initial coding
carl
parents:
diff changeset
58 status syslog2iptables
128cae6f3459 initial coding
carl
parents:
diff changeset
59 RETVAL=$?
128cae6f3459 initial coding
carl
parents:
diff changeset
60 ;;
128cae6f3459 initial coding
carl
parents:
diff changeset
61 *)
128cae6f3459 initial coding
carl
parents:
diff changeset
62 echo "Usage: syslog2iptables {start|stop|restart|status}"
128cae6f3459 initial coding
carl
parents:
diff changeset
63 exit 1
128cae6f3459 initial coding
carl
parents:
diff changeset
64 esac
128cae6f3459 initial coding
carl
parents:
diff changeset
65 exit $RETVAL
128cae6f3459 initial coding
carl
parents:
diff changeset
66
128cae6f3459 initial coding
carl
parents:
diff changeset
67 # $Id$