#! /bin/sh
### BEGIN INIT INFO
# Provides:          filtrage_firewall
# Required-Start:    $remote_fs $syslog firewall
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Filtrage Firewall
# Description:       Firewall logfile Parsing.
### END INIT INFO


set -e

case "$1" in
  start)
	echo -n "Démarrage du script de parsage des logs du firewall"
	start-stop-daemon --start --quiet --background --make-pidfile --pidfile /var/run/filtrage_firewall.pid --exec /usr/scripts/surveillance/filtrage_firewall.py
        echo "."
	;;
  stop)
        echo -n "Arrêt du parsage des logs du firewall"
	start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/filtrage_firewall.pid
        echo "."
	;;

  restart)
        echo -n "Redémarrage du parsage des logs du firewall"
	start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/filtrage_firewall.pid
        sleep 1
	echo -n "Démarrage du script de parsage des logs du firewall"
	start-stop-daemon --start --quiet --background --make-pidfile --pidfile /var/run/filtrage_firewall.pid --exec /usr/scripts/surveillance/filtrage_firewall.py
        echo "."
	;;

  *)
	echo "Usage: /etc/init.d/filtrage_firewall {start|stop|restart}"
	exit 1
esac
 
exit 0
