#!/bin/sh
#
# System V init script for iptables logfile analyzer
#
# (c) Thomas Vallaitis <bonewood@gmx.net>
#
# pid isn't saved by iptables logfile analyzer (afaik) 
# we have two processes -> more difficult
#

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
LONGNAME="iptables logfile analyzer"
NAME="iptablelog"
DAEMON='/usr/local/bin/feed_db.pl'

set -e

# Main Loop
case $1 in
start)
      echo -n "Starting $LONGNAME: ";
      start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- --background
      echo $NAME;
        ;;
stop)
      echo -n "Stopping $LONGNAME: "
      start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid || true
      rm -f /var/run/$NAME.pid
      echo $NAME
        ;;
*)
        N=/etc/init.d/$NAME
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $N {start|stop}" >&2
        exit 1
        ;;
esac

exit 0

# EOF