mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-04 20:29:09 +01:00
3ecfa23e5c
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
49 lines
786 B
Bash
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
|
|
|