4 # Author: Cherwin Nooitmeer <cherwin@gmail.com>
13 # regular expression that matches queue IDs (e.g. D71EF7AC80F8)
14 queue_id='^[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]'
16 usage="Invalid command line usage"
23 while getopts ":w:c:" options
26 w ) warning=$OPTARG ;;
27 c ) critical=$OPTARG ;;
33 # determine queue size
34 qsize=$(mailq | egrep -c $queue_id)
40 if [ $qsize -ge $critical ]; then
42 elif [ $qsize -ge $warning ]; then
44 elif [ $qsize -lt $warning ]; then
48 echo "$qsize mail(s) in queue | mail_queue=$qsize"