slackbuilds_ponce/network/barnyard2/rc.barnyard2
Niels Horn 3ecfa23e5c network/barnyard2: Added (log parser for snort)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2010-10-15 22:16:57 -05:00

49 lines
786 B
Bash

#!/bin/sh
# Start/stop/restart barnyard2
# Settings
SNORTLOGDIR=${SNORTLOGDIR:-/var/log/snort}
SNORTLOGFILE=${SNORTLOGFILE:-snort.log}
IFACE=${IFACE:-any}
PIDFILE=/var/run/barnyard2_$IFACE.pid
LOGDIR=/var/log/barnyard2
# Start snort:
by2_start() {
CMDLINE="/usr/bin/barnyard2 -i $IFACE -d $SNORTLOGDIR -f $SNORTLOGFILE -n -D "
echo -n "Starting Barnyard2 daemon: $CMDLINE"
$CMDLINE --pid-path /var/run --create-pidfile -l $LOGDIR
echo
}
# Stop snort:
by2_stop() {
echo -n "Stopping Barnyard2 daemon..."
kill $(cat $PIDFILE)
echo
sleep 1
rm -f $PIDFILE
}
# Restart snort:
by2_restart() {
by2_stop
sleep 1
by2_start
}
case "$1" in
'start')
by2_start
;;
'stop')
by2_stop
;;
'restart')
by2_restart
;;
*)
echo "usage $0 start|stop|restart"
esac