Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
nagios-plugins
nagios-plugins-1.4.14-check_log.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File nagios-plugins-1.4.14-check_log.patch of Package nagios-plugins
Index: plugins-scripts/check_log.sh =================================================================== --- plugins-scripts/check_log.sh.orig +++ plugins-scripts/check_log.sh @@ -61,15 +61,16 @@ #PATH="" ECHO="/bin/echo" -GREP="/bin/egrep" -DIFF="/bin/diff" -TAIL="/bin/tail" +GREP="/usr/bin/egrep" +DIFF="/usr/bin/diff" +TAIL="/usr/bin/tail" CAT="/bin/cat" RM="/bin/rm" CHMOD="/bin/chmod" -TOUCH="/bin/touch" +TOUCH="/usr/bin/touch" +MKTEMP="/bin/mktemp" -PROGNAME=`/bin/basename $0` +PROGNAME=`/usr/bin/basename $0` PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` REVISION="@NP_VERSION@" @@ -166,10 +167,10 @@ # If the source log file doesn't exist, exit -if [ ! -e $logfile ]; then +if [ ! -e "$logfile" ]; then $ECHO "Log check error: Log file $logfile does not exist!\n" exit $STATE_UNKNOWN -elif [ ! -r $logfile ] ; then +elif [ ! -r "$logfile" ] ; then $ECHO "Log check error: Log file $logfile is not readable!\n" exit $STATE_UNKNOWN fi @@ -178,8 +179,8 @@ # we're running this test, so copy the original log file over to # the old diff file and exit -if [ ! -e $oldlog ]; then - $CAT $logfile > $oldlog +if [ ! -e "$oldlog" ]; then + $CAT "$logfile" > "$oldlog" $ECHO "Log check data initialized...\n" exit $STATE_OK fi @@ -188,25 +189,25 @@ # The temporary file that the script should use while # processing the log file. -if [ -x /bin/mktemp ]; then - tempdiff=`/bin/mktemp /tmp/check_log.XXXXXXXXXX` +if [ -x "$MKTEMP" ]; then + tempdiff=`$MKTEMP /tmp/check_log.XXXXXXXXXX` 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\n"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor