0
drwxr-xr-x  2 smmsp smmsp  4.0K May  6 23:31 mqueue
drwxrws---  2 smmsp smmsp  29M May  8 10:40 mqueue-client

As you can see mqueue-client is filled with 29 megabytes of unsent mail. This seems to be likely from an internal function sending mail to localhost which is failing.

I've tried numerous attempts to clear the queue but none have succeeded. The result is a process using up significant CPU resources:

16287 smmsp     20   0 50212  44m 2416 R   85  4.4 965:35.45 sendmail-msp

I've tried killing the process, stopping the sendmail service, deleting the contents of the mqueue-client and even switching to the smmsp user. But none have worked. rm hangs when trying to remove the mail.

How can I go about emptying this queue?

Once I've done this I'll move everything over to Postfix.

Brodie
  • 105
  • 1
  • 7

1 Answers1

0

As suggested by Janne in the comments, I looked over my syslog and found many mail failing to send errors which was causing them to be deferred thus pile up in the mqueue-client folder.

After doing some digging it turns out crontab is set to mail root on completion/notices/warnings/errors. By issuing crontab -e and adding MAILTO="" to the top of the config, no more mail is sent out, problem fixed!

Now I'm clearing out the 1.5 million or so bad emails from mqueue-client using this Bash script:

#!/usr/bin/env bash

cd mqueue-client

deleted=0

for i in `ls`
do
        rm -f $i
        percentage=$(bc <<< "scale=2; ($deleted / 1035435) * 100")
        ((deleted++))

        echo "Deleted $i. Files deleted $deleted. $percentage% complete."
done

Run from /var/spool using ./filename

Update

Unfortunately after running this script all night the mail queue wasn't being significantly reduced. This was because I hadn't disabled the minute running CRON that was set to clear the queue but was resulting in the backlog growing. Hopefully now this is disabled everything should clear.

Brodie
  • 105
  • 1
  • 7