updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / iptlogger / iptlogd
blob6c56405634c4bb82165444fa2bdf944642a54061
1 #!/bin/bash
2 # This file belongs in /etc/rc.d
4 ###############################################################################
6 #inserting certain functions (like stat_busy)
7 . /etc/rc.conf
8 . /etc/rc.d/functions
10 # Check the file is there and is executable.
11 [ -x /usr/bin/feed_db.pl ] || exit 0
13 PID=`pidof -o %PPID /usr/bin/perl /usr/bin/feed_db.pl`
15 # See how we were called.
16 case "$1" in
17 start)
18 stat_busy "Starting IPtables Logging Daemon "
19 if [ -z "$PID" ]; then
20 /usr/bin/feed_db.pl >/dev/null &
21 RETVAL=$? #storing the status of the last command to RETVAL
22 if [ $? -gt 0 ]; then #if the status was other than 0, the command failed
23 stat_fail
24 exit 1
25 else
26 add_daemon iptlogd
27 stat_done
29 else
30 stat_fail
31 echo ":: Daemon already started as pid $PID"
32 exit 1
33 fi
35 stop)
36 stat_busy "Stopping IPtables Logging Daemon "
37 if [ "$PID" != "" ]; then #if PID exists
38 kill -KILL $PID &>/dev/null
39 stat_done
40 if [ $? -gt 0 ]; then
41 stat_fail
42 exit 1
43 else
44 RETVAL=$?
45 rm_daemon iptlogd
47 else
48 stat_fail
49 echo ":: Daemon already stopped"
50 exit 1
53 restart|reload)
54 $0 stop
55 $0 start
56 RETVAL=$?
59 echo "Usage: partimaged {start|stop|restart|reload}"
60 exit 1
61 esac
62 exit $RETVAL