From 4f6057385c6caa205b2979017025d63bd853dbda Mon Sep 17 00:00:00 2001 From: Daniele Palumbo Date: Sun, 4 Dec 2016 23:00:56 +0100 Subject: [PATCH] Fixed warning in case of permission denied Before if the find was failing, the script was returning OK. Also a different way to check the queue has been implemented. --- check_postfix_mailqueue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/check_postfix_mailqueue b/check_postfix_mailqueue index 131a2af..18ffa3d 100755 --- a/check_postfix_mailqueue +++ b/check_postfix_mailqueue @@ -188,7 +188,8 @@ cd $SPOOLDIR >/dev/null 2>/dev/null || { # Get values for i in deferred active maildrop incoming corrupt hold; do - eval $i=`(test -d $i && find $i -type f ) | wc -l` + test -d $i && test -r $i || { echo -n "unable to check queue $i"; exit $STATE_CRIT; } + eval $i=$(qshape $i | grep "TOTAL" | awk '{print $2}') done for state in crit warn; do