How to delete millions thousands of exim mail queues using ssh command line

how-delete-millions-thousands-exim-mail-queues-ssh-command-line

How to delete millions thousands of exim mail queues using ssh command line

How to delete millions thousands of exim mail queues using ssh command line

What will you do when some of your scripts are infected and injected with mail sending script.

That sends millions of mails, curing the script is the first step and its easy too.
but clearing the millions of mails on mail queue, that will be like pain in the a**

There are few simple ways to clear the mail queues.

To find the no of mails on the mail(exim) queue, use
exim -bpc
This command may take some time to display the result, which depends on the no of mails in the queue.

First one is to delete whole queue, if its only few thousand mails.
Using the exim -bo

You also try the below commands, which is categorised.

#Remove the frozen messages.

#Remove nobody mails

#Remove mail older than 1 day

The above commands will clear the mails only when you keep the exim running.
that will be the hard task and exim may create new mails to delivery.

If the above commands didn’t work for you, then the alternate way is to delete the mails manually.

We have to do it in the hardway. 🙁

Just stop the mail server by

service exim stop

then, change directory to /var/spool/exim

Now, execute the below command, which will delete all the mails on the mail queue folder.

Now, we also need to run the command for msglog folder too.

Once done, start the mailserver exim.

I hope this helped you,
Help us in sharing our Blog to the needy.

About ilangovan ramasamy

I am a IT manager on a Corporate co. Started My Career In a Internet Center. having 10 years on Experience on IT. Very much Interested in knowing New technologies & gadgets. Wrote many Articles & how to’s for Computer Related issues. As I am in to hosting industry We face many issues on work. I thought of sharing my knowledge with you and writing so. If you guys feel something is interesting & helpful, Please do comment on it.

View all posts by ilangovan ramasamy →

Comments