Author Topic: check mailqueue version 2.1 on new mail hosting  (Read 9996 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2145
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
check mailqueue version 2.1 on new mail hosting
« on: มกราคม 24, 2011, 02:25:39 PM »
#!/bin/sh

############################################################
# Check process mailqueue if over limit send mail to Tier1 #
# Check every 15 Mins                                      #
# Version 2.1 By golfreeze                                 #
############################################################

export PATH=/usr/bin:/sbin:/usr/sbin:/bin

DATE=`/bin/date`
CHECKMQQ=`/usr/local/sbin/postqueue -p | grep "Kbytes in" | awk -F 'Kbytes in' '{print $2}' | sed s/Requests.//g`
CHECKLOAD=`uptime | awk -F 'load averages:' '{print $2}'`
#echo "Mailqueue in system Now = $CHECKMQQ"

#convert string to integer"
CHECKMQ=`/bin/expr $CHECKMQQ`

#Input limitover value
limitover=300

#######
# -gt = more than
# -lt = less than


if [ "$CHECKMQ" -gt "$limitover" ]
then
        echo "Dear Tier1" > /home/golf/___script___/sms_send.txt
        echo "Today = $DATE " >> /home/golf/___script___/sms_send.txt
        echo "Now Mailqueue in SMTP00 is $CHECKMQ more than $limitover " >> /home/golf/___script___/sms_send.txt
        echo "Now Load in server is $CHECKLOAD " >> /home/golf/___script___/sms_send.txt
        echo "Urgent urgent!!!!  >> /home/golf/___script___/sms_send.txt
        echo "Subject: Urgent!!! Mailqueue in SMTP00 Higher" | cat - /home/golf/___script___/sms_send.txt  | sendmail -F "bot-checkmq@xxxx.th" -f bot-checkmq@xxx.th  dc-ops@xxxo.th         

        sleep 5
        exit 1
else
        echo "Now Mailqueue is $CHECKMQ less than $limitover"
fi

Amatotottlil

  • Guest
Re: check mailqueue version 2.1 on new mail hosting
« Reply #1 on: มิถุนายน 15, 2011, 05:03:57 PM »
 :D ;D ;D