Not at all.
First of all having all instances in a same script mean that you have to wait
Nth time for the Nth instance whil having parallel script you can all
start them up at the same time.
And you can stop individual instances instead of stoping them all,
less of an issue in my book.
>
> these are my start() und stop() parts from the /etc/init.d/barnyard2:
>
> start() {
> echo $"Starting $desc ($prog): "
> for INT in $INTERFACES; do
> echo -n "starting $INT..."
> PIDFILE="/var/run/barnyard2-$INT.pid"
> ARCHIVEDIR="$SNORTDIR/$INT/archive"
> WALDO_FILE="$SNORTDIR/$INT/barnyard2.waldo"
> # We need Interfaced PIDs, otherwise we can't lock
> EXTRA_ARGS="-i $INT -v"
> #BARNYARD_OPTS="-D -c $CONF -d $SNORTDIR/${INT} -f $LOG_FILE
> -w $WALDO_FILE -a $ARCHIVEDIR -G /etc/snort/gen-msg.map -S
> /etc/snort/sid-msg.map -C /etc/snort/classification.config $EXTRA_ARGS"
> BARNYARD_OPTS="-D -c $CONF -d $SNORTDIR/${INT} -f $LOG_FILE
> -w $WALDO_FILE -a $ARCHIVEDIR $EXTRA_ARGS"
> echo " used $BARNYARD_OPTS"
> $barnyardBin $BARNYARD_OPTS
> done
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/run/$prog
> return $RETVAL
> }
>
having PIDFILE variable in your script and not passed to barnyard2
process in command line wont make it use a different
PIDFILE so check that out ;)
> stop() {
> echo $"Shutting down $desc ($prog): "
> #for f in `ls /var/run/$prog*.pid`;do
> #echo "killing `basename $f`"
> #/sbin/killproc -p $f -TERM $barnyardBin && rm ${f}.lck
> #done
> #RETVAL=$?
> #echo "killed $prog"
> #[ $RETVAL -eq 0 ] && rm -f /var/run/$prog
> pkill barnyard2
> RETVAL=$?
> return $RETVAL
> }
>
and issuing a SIGKILL to process is a bit nasty, you should maybe try
to send SIGINT.
> in my opinion the pid file is specific for each interface, so that shouldn't
> be a problem. as it 'usually' works i'm really not sure if it's a general
> issue on my startup script or if it's rather a timing issue where i need to
> wait longer for files to be ready
>
Nope your script is not doing that ATM, you have the variable set but
its not given to command line.
so you might want to fix it.
But overall it is your setup.
But from my observation point, right now there is enhancement to be
to make everything more reliable and to be able to diagnostic some
possible issue not related to
launch Nth process in a row.
-elz