#!/bin/sh -e

test -f /usr/sbin/snort || exit 0

PATH=/bin:/usr/bin:/sbin:/usr/sbin

CONFIG=/etc/snort/snort.conf
. $CONFIG
export DEBIAN_SNORT_STATS_RCPT DEBIAN_SNORT_STATS_TRESHOLD

# if snort is configured to only run at dialup connection starts
# the init.d script would not start it at the end of this script.
if [ -n "`ps ax|grep snort|grep -v grep|grep -v $0`" ]; then
   SNORT_WAS_RUNNING=1
fi

  savelog -c 14 /var/log/snort/snort.log	>/dev/null
  test -n "$SNORT_WAS_RUNNING" && /etc/init.d/snort restart >/dev/null
  snort-stat `syslogd-listfiles --auth`


exit 0
