Created
July 3, 2015 11:07
-
-
Save betagan/3bf1356adb98b580e91a to your computer and use it in GitHub Desktop.
test script to reproduce check_logfiles bug concerning wrong rotation handling for files with same timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CLCMD="./check_logfiles --logfile=my.log --rotation=my.log.gz --criticalpattern=ERROR" | |
echo ">>> cleaning up, removing my.log and my.log.gz, creating empty my.log and initialize run check_logfiles" | |
rm -f my.log.gz my.log | |
echo "OK some dummy text" > my.log | |
sleep 1 | |
$CLCMD | |
echo ">>> append an ERROR line" | |
printf "ERROR dummy\n" >> my.log | |
sleep 1 | |
echo ">>> running check_logfiles for the first time (should and does return CRITICAL)" | |
$CLCMD | |
echo ">>> performing log rotation and put one OK line in the new logfile" | |
gzip -c my.log > my.log.gz && echo "OK" > my.log | |
sleep 1 | |
echo ">>> running check_logfiles for the second time (should and does return OK)" | |
$CLCMD | |
echo ">>> append a second OK line to the logfile" | |
printf "OK some dummy text\n" >> my.log | |
sleep 1 | |
echo ">>> running check_logfiles for the third time (should return OK BUT DOES RETURN CRITICAL INSTEAD!!" | |
$CLCMD | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment