aboutsummaryrefslogtreecommitdiff
path: root/network/barnyard2/rc.barnyard2
diff options
context:
space:
mode:
authorNiels Horn <niels.horn@gmail.com>2010-10-15 22:16:57 -0500
committerRobby Workman <rworkman@slackbuilds.org>2010-10-15 22:16:57 -0500
commit3ecfa23e5c1bdf24ffef0b08f3197ea9709fb7ec (patch)
treefe115883ada4cd1837bd36dedc09ca848d39234d /network/barnyard2/rc.barnyard2
parent91e62177b4609cb34fd1d4063287ec4e39879794 (diff)
network/barnyard2: Added (log parser for snort)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'network/barnyard2/rc.barnyard2')
-rw-r--r--network/barnyard2/rc.barnyard249
1 files changed, 49 insertions, 0 deletions
diff --git a/network/barnyard2/rc.barnyard2 b/network/barnyard2/rc.barnyard2
new file mode 100644
index 0000000000000..93e899f4c9e95
--- /dev/null
+++ b/network/barnyard2/rc.barnyard2
@@ -0,0 +1,49 @@
+#!/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
+