diff options
Diffstat (limited to 'network/barnyard2/rc.barnyard2')
-rw-r--r-- | network/barnyard2/rc.barnyard2 | 49 |
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 + |