6
|
1 #!/bin/sh
|
|
2 #
|
|
3 # syslog2iptables This script controls the syslog2iptables daemon.
|
|
4 #
|
|
5 #
|
|
6 # chkconfig: 2345 60 40
|
|
7 # description: syslog2iptables monitors syslog files, parses them, and update the iptables filters
|
|
8 # processname: syslog2iptables
|
|
9 # pidfile: /var/run/syslog2iptables.pid
|
|
10 # Source function library.
|
|
11 #
|
|
12 . /etc/rc.d/init.d/functions
|
|
13
|
|
14 # Source networking configuration.
|
|
15 . /etc/sysconfig/network
|
|
16
|
|
17 RETVAL=0
|
|
18 # See how we were called.
|
|
19 case "$1" in
|
|
20 start)
|
|
21 # Start daemons.
|
|
22 echo -n "Starting syslog2iptables: "
|
|
23 if [ ! -f /var/lock/subsys/syslog2iptables ]; then
|
|
24 cd /etc # conf file is here
|
7
|
25 /usr/local/sbin/syslog2iptables -d 2
|
6
|
26 RETVAL=$?
|
|
27 pid=`pidof -s /usr/local/sbin/syslog2iptables`
|
|
28 if [ $pid ]
|
|
29 then
|
|
30 success "Starting syslog2iptables :"
|
|
31 touch /var/lock/subsys/syslog2iptables
|
|
32 echo
|
|
33 else
|
|
34 failure "Starting syslog2iptables:"
|
|
35 echo
|
|
36 fi
|
|
37 else
|
|
38 echo -n "already running! "
|
|
39 failure "syslog2iptables already running!"
|
|
40 echo
|
|
41 fi
|
|
42
|
|
43 ;;
|
|
44 stop)
|
|
45 # Stop daemons.
|
|
46 echo -n "Shutting down syslog2iptables: "
|
|
47 killproc syslog2iptables
|
|
48 RETVAL=$?
|
|
49 echo
|
|
50 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/syslog2iptables
|
|
51 ;;
|
|
52 restart|reload)
|
|
53 $0 stop
|
|
54 $0 start
|
|
55 RETVAL=$?
|
|
56 ;;
|
|
57 status)
|
|
58 status syslog2iptables
|
|
59 RETVAL=$?
|
|
60 ;;
|
|
61 *)
|
|
62 echo "Usage: syslog2iptables {start|stop|restart|status}"
|
|
63 exit 1
|
|
64 esac
|
|
65 exit $RETVAL
|
|
66
|
|
67 # $Id$
|