From c08d6a429ba0e0cd3642ba2c2fe85687472ee22f Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Fri, 28 Feb 2014 13:28:33 +0100 Subject: Replace "plugins-scripts/subst.in" foo Remove the buggy and complex awk(1) magic in "plugins-scripts/subst.in" in favor of simple sed(1) substitutions. The plugins in the "plugins-scripts" directory now always use the PATH specified via "./configure --trusted-path", or the default PATH hard-coded in "configure.ac". Fixes #1242. --- plugins-scripts/check_log.sh | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'plugins-scripts/check_log.sh') diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index be4c7be1..8653a5e1 100755 --- a/plugins-scripts/check_log.sh +++ b/plugins-scripts/check_log.sh @@ -58,18 +58,12 @@ # Paths to commands used in this script. These # may have to be modified to match your system setup. -GREP="/bin/egrep" -DIFF="/bin/diff" -TAIL="/bin/tail" -CAT="/bin/cat" -RM="/bin/rm" -CHMOD="/bin/chmod" -TOUCH="/bin/touch" - PROGNAME=`/bin/basename $0` PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` REVISION="@NP_VERSION@" -PATH="@trusted_path@" +PATH="@TRUSTED_PATH@" + +export PATH . $PROGPATH/utils.sh @@ -177,7 +171,7 @@ fi # the old diff file and exit if [ ! -e $oldlog ]; then - $CAT $logfile > $oldlog + cat $logfile > $oldlog echo "Log check data initialized..." exit $STATE_OK fi @@ -191,20 +185,20 @@ if [ -x /bin/mktemp ]; then else tempdiff=`/bin/date '+%H%M%S'` tempdiff="/tmp/check_log.${tempdiff}" - $TOUCH $tempdiff - $CHMOD 600 $tempdiff + touch $tempdiff + chmod 600 $tempdiff fi -$DIFF $logfile $oldlog | $GREP -v "^>" > $tempdiff +diff $logfile $oldlog | grep -v "^>" > $tempdiff # Count the number of matching log entries we have -count=`$GREP -c "$query" $tempdiff` +count=`grep -c "$query" $tempdiff` # Get the last matching entry in the diff file -lastentry=`$GREP "$query" $tempdiff | $TAIL -1` +lastentry=`grep "$query" $tempdiff | tail -1` -$RM -f $tempdiff -$CAT $logfile > $oldlog +rm -f $tempdiff +cat $logfile > $oldlog if [ "$count" = "0" ]; then # no matches, exit with no error echo "Log check ok - 0 pattern matches found" -- cgit v1.2.3-74-g34f1