系统相关
首页 > 系统相关> > linux – 清除exim邮件队列是否正确?

linux – 清除exim邮件队列是否正确?

作者:互联网

我使用以下命令删除exim邮件队列

exiqgrep -i | xargs exim -Mrm

要么

# following commands seems to work faster compared to the above.
exim -bpru | awk {'print $3'} | xargs exim -Mrm

但是当邮件队列大小超过100,000时,上述命令不起作用.它被卡住了.因此,我使用以下脚本,无论队列中的邮件数量多少,该脚本都能正常工作.

我的问题是,它会正确删除吗?

/etc/init.d/exim stop;
sleep 10;
killall -9 exim eximd
sleep 5;

#clean out the mail queue
find /var/spool/exim -mindepth 2 -type f -exec rm -rfv {} \;

#clean out the mail db files
find /var/spool/exim/db -type f -exec rm -rvf {} \;

/etc/init.d/exim restart

解决方法:

我相信你在寻找……

service exim stop
rm -fvr /var/spool/exim/input
service exim restart

然而,一个稍微更合理的方法是删除每个用户的消息…

egrep -Rl "((`pwd | cut -d / -f3`|$(grep `pwd | cut -d / -f3` /etc/userdomains | cut -d : -f1 | tr '\n' '|' | sed 's/|$//g'))|/home/`pwd | cut -d / -f3`)|X-Failed-Recipients" /var/spool/exim/input --include='*-H' | awk -F "/" '{gsub("-[A-Z]$","");print$NF}' | xargs exim -Mrm 

标签:exim,linux,email,cpanel
来源: https://codeday.me/bug/20190814/1655068.html