Qmail queue remover
#!/bin/bash echo "Qmail needs to be STOPPED!!!"; cd /var/qmail/queue/mess if [ "$1" == "" ] || [ "$1" == "help" ] || [ "$1" == "--help" ]; then echo "ex: $0 option=string rm=no|yes"; echo "Default rm is set to 'no' and $0 only print messages containg specified string"; echo; echo " Options are:"; echo " subject='string' - If Subject containing 'string'"; echo " to='string' - If To: line containing 'string'"; echo " from='string' - If From: line containig 'string'"; echo " mess='string' - Looking in the whole message"; echo " help - print this message and exit"; echo; exit 1 fi #echo $2; RM1=`echo $2 | cut -d "=" -f 2`; #echo $RM1; RM2=`echo $2 | cut -d "=" -f 1`; #echo $RM2; #echo $1; STR1=`echo $1 | cut -d "=" -f 2`; #echo $STR1; STR2=`echo $1 | cut -d "=" -f 1`; #echo $STR2; echo "Enter 'yes' to start"; read key if [ "$key" == "yes" ]; then echo "Start..."; else echo "Canceled..."; exit 1 fi case "$STR2" in subject ) GREP=`grep "^Subject: " * -r -m 1 | grep "$STR1" | awk {'print $1'} | cut -d "/" -f 2 | cut -d ":" -f 1`; ;; to ) GREP=`grep "^To: " * -r -m 1 | grep "$STR1" | awk {'print $1'} | cut -d "/" -f 2 | cut -d ":" -f 1`; ;; from ) GREP=`grep "^From: " * -r -m 1 | grep "$STR1" | awk {'print $1'} | cut -d "/" -f 2 | cut -d ":" -f 1`; ;; mess ) GREP=`grep "$STR1" * -r -m 1 | awk {'print $1'} | cut -d "/" -f 2 | cut -d ":" -f 1`; ;; * ) echo "'$STR2' is not an option!!!"; echo "See $0 help for options"; exit 1 ;; esac echo "Deleting messages with '${STR2}' line like '${STR1}'..."; for i in $GREP; do FIND=`find /var/qmail/queue/ -name $i`; if [ "$RM1" == "yes" ]; then for a in $FIND; do echo "Deleting: $a"; rm -vf $a done else for a in $FIND; do echo "Not Deleted: $a"; done fi done echo "Done!";
Comments:
waelsettec@...com (15-02-2009 22:36) :
i have problem in my qmail queue i do this commands :
qmailctl stop
find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;
qmailctl start
after this i haven't qmail queue any masseges i send it i can't see it in queue in case i send to failer domain it must be traying to send it but in my case i see that no thing in queue
thx for help to recover my queue
waelwaelsettec@...com (16-02-2009 08:06) :
i have problem in my qmail queue i do this commands :
qmailctl stop
find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;
qmailctl start
after this i haven't qmail queue any masseges i send it i can't see it in queue in case i send to failer domain it must be traying to send it but in my case i see that no thing in queue
thx for help to recover my queue
wael
This page was last modified on 2025-02-18 10:43:57