#!/bin/sh
NOADEXE="/usr/bin/noad"
NOADPARM="--statisticfile=/var/log/noadstat -c -o -a -j -O"


if [ -s $NOADEXE ] ; then
   CHK_BEFORE=`echo $1 | grep "^before"`
   if [ "$CHK_BEFORE" = "" ] ; then
      PARM1=`echo $1 | grep "^/video"`
      if [ "$PARM1" != "" ] ; then
         CMD="$NOADEXE $NOADPARM - $1"
      else
         CMD="$NOADEXE $NOADPARM $1 $2"
      fi
      echo "Starting <$CMD>"
      echo "$CMD" > /tmp/~noad
      chmod +x /tmp/~noad
      at -f /tmp/~noad now
   else
      echo "Not starting <$NOADEXE>"
   fi
else
   echo "<$NOADEXE> not found"
fi
