annotate syslog2iptables.rc @ 7:390ac4e01472

initial coding
author carl
date Fri, 02 Dec 2005 20:36:01 -0800
parents 128cae6f3459
children d76f9ff42487
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
128cae6f3459 initial coding
carl
parents:
diff changeset
1 #!/bin/sh
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
128cae6f3459 initial coding
carl
parents:
diff changeset
24 cd /etc # conf file is here
7
390ac4e01472 initial coding
carl
parents: 6
diff changeset
25 /usr/local/sbin/syslog2iptables -d 2
6
128cae6f3459 initial coding
carl
parents:
diff changeset
26 RETVAL=$?
128cae6f3459 initial coding
carl
parents:
diff changeset
27 pid=`pidof -s /usr/local/sbin/syslog2iptables`
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$