Barnyard2 error on start

0

Been setting up a snort box with barnyard2, run into the error below. Can someone please help?

$Starting Snort Output Processor (barnyard2): ./barnyard2: 35: ./barnyard2: barnyard2: not found

/etc/init.d/barnyard2 file

    #!/bin/sh
#
# Init file for Barnyard2
#
#
# chkconfig: 2345 40 60
# description:  Barnyard2 is an output processor for snort.
#
# processname: barnyard2
# config: /etc/sysconfig/barnyard2
# config: /etc/snort/barnyard.conf
# pidfile: /var/lock/subsys/barnyard2.pid


[ -x /usr/sbin/snort ] || exit 1
[ -r /etc/snort/snort.conf ] || exit 1

### Default variables
SYSCONFIG="/etc/default/barnyard2"

### Read configuration
[ -r "$SYSCONFIG" ] && . "$SYSCONFIG"

RETVAL=0
prog="barnyard2"
desc="Snort Output Processor"

start() {
       echo -n $"Starting $desc ($prog): "
       for INT in $INTERFACES; do
               PIDFILE="/var/lock/barnyard2-$INT.pid"
               ARCHIVEDIR="$SNORTDIR/$INT/archive"
               WALDO_FILE="$SNORTDIR/$INT/barnyard2.waldo"
               BARNYARD_OPTS="-D -c $CONF -d $SNORTDIR/${INT} -w $WALDO_FILE -l $SNORTDIR/${INT} -a $ARCHIVEDIR -f $LOG_FILE -X $PIDFILE $EXTRA_ARGS"
               $prog $BARNYARD_OPTS
       done
       RETVAL=$?
       echo
       [ $RETVAL -eq 0 ] && touch /var/lock/$prog
       return $RETVAL
}

stop() {
       echo -n $"Shutting down $desc ($prog): "
       killall $prog
       RETVAL=$?
       echo
       [ $RETVAL -eq 0 ] && rm -f /var/lock/$prog
       return $RETVAL
}

restart() {
       stop
       start
}


reload() {
       echo -n $"Reloading $desc ($prog): "
       killall $prog -HUP
       RETVAL=$?
       echo
       return $RETVAL
}


case "$1" in
 start)
       start
       ;;
 stop)
       stop
       ;;
 restart)
       restart
       ;;
 reload)
       reload
       ;;
 condrestart)
       [ -e /var/lock/$prog ] && restart
       RETVAL=$?
       ;;
 status)
       status $prog
       RETVAL=$?
       ;;
dump)
       dump
       ;;
 *)
       echo $"Usage: $0 {start|stop|restart|reload|condrestart|status|dump}"
       RETVAL=1
esac

exit $RETVAL

If you want me to most more files please let me know.

user3329963

Posted 2014-11-10T11:03:44.323

Reputation: 51

Answers

0

The issue appears to be in line 35 of your init script:

$prog $BARNYARD_OPTS

It is complaining that it cannot find barnyard2. Try either changing your $PATH, installing to a different location, or changing the prog=barnyard2 line to point to the full path, for example prog=/usr/local/bin/barnyard (which would also require changing .

On a side note, I believe you will need to change the -X option to --pid-path as the directory in which to store the pid file.

Greg Bowser

Posted 2014-11-10T11:03:44.323

Reputation: 1 491