Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mail:exim-management [2013-03-22 15:55:06]
shaun.reitan [Queue Management]
mail:exim-management [2018-04-17 11:51:05]
shaun.reitan [Queue Management]
Line 1: Line 1:
-====== ​Quick & Dirty Exim Management ======+====== Exim Management ​Command List ======
 Below are some shell commands that can be used to manage Exim and it's email queue. The commands listed below must be run as root. Below are some shell commands that can be used to manage Exim and it's email queue. The commands listed below must be run as root.
  
-==== Managing Exim Itself ====+===== Managing Exim Itself ​=====
  
 Start/​Stop/​Restart Exim Start/​Stop/​Restart Exim
-<sxh bash>/​etc/​init.d/​exim start|stop|restart</​sxh>+<code> 
 +/​etc/​init.d/​exim start|stop|restart 
 +</code>
  
 Print what Exim is doing right now Print what Exim is doing right now
-<sxh bash>​exiwhat</​sxh>+<code> 
 +exiwhat 
 +</code>
  
 Test how exim will route a given email address Test how exim will route a given email address
-<sxh bash>exim -bt email@address.tld</​sxh>+<code> 
 +exim -bt email@address.tld 
 +</code>
  
 Generate and display Exim stats from a logfile Generate and display Exim stats from a logfile
-<sxh bash>​eximstats /​path/​to/​exim_mainlog</​sxh>+<code> 
 +eximstats /​path/​to/​exim_mainlog 
 +</code>
  
 Run a pretend SMTP transaction from the command line, as if it were coming from the given IP address. This will display Exim’s checks, ACLs, and filters as they are applied. Replace x.x.x.x with the IP you want to use as the source Run a pretend SMTP transaction from the command line, as if it were coming from the given IP address. This will display Exim’s checks, ACLs, and filters as they are applied. Replace x.x.x.x with the IP you want to use as the source
  
-<sxh bash>exim -bh x.x.x.x</​sxh>+<code> 
 +exim -bh x.x.x.x 
 +</code>
  
 Display all of Exim’s configuration settings Display all of Exim’s configuration settings
  
-<sxh bash>exim -bP</sxh+<code> 
- +exim -bP 
-==== Queue Information ====+</code
 +\\ 
 +\\ 
 +===== Queue Information ​=====
  
 Print a count of messages in the queue Print a count of messages in the queue
-<sxh bash>exim -bpc</sxh>+<code> 
 +exim -bpc 
 +</code>
  
 Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient) Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient)
-<sxh bash>exim -bp</sxh>+<code> 
 +exim -bp 
 +</code>
  
 Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals) Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals)
-<sxh bash>exim -bp | exiqsumm</​sxh+<code> 
- +exim -bp | exiqsumm 
-==== Searching the Queue ====+</code
 +\\ 
 +\\ 
 +===== Searching the Queue =====
  
 Search the queue for messages from a specific sender Search the queue for messages from a specific sender
  
-<sxh bash>​exiqgrep -f [user]@domain</​sxh>+<code> 
 +exiqgrep -f [user]@domain 
 +</code>
  
 Search the queue for messages for a specific recipient/​domain Search the queue for messages for a specific recipient/​domain
  
-<sxh bash>​exiqgrep -r [user]@domain</​sxh>+<code> 
 +exiqgrep -r [user]@domain 
 +</code>
  
 Print just the message-id as a result of one of the above two searches Print just the message-id as a result of one of the above two searches
  
-<sxh bash>​exiqgrep -i [ -r | -f ] ...</sxh>+<code> 
 +exiqgrep -i [ -r | -f ] ... 
 +</code>
  
 Print a count of messages matching one of the above searches Print a count of messages matching one of the above searches
  
-<sxh bash>​exiqgrep -c [ -r | -f ] ...</sxh>+<code> 
 +exiqgrep -c [ -r | -f ] ... 
 +</code>
  
 Print just the message-id of the entire queue Print just the message-id of the entire queue
  
-<sxh bash>​exiqgrep -i</sxh>+<code> 
 +exiqgrep -i 
 +</code>
  
-==== Viewing Messages In The Queue ====+Print just the message-id of frozen messages in the queue 
 + 
 +<​code>​ 
 +exiqgrep -iz 
 +</​code>​ 
 +\\ 
 +\\ 
 +===== Viewing Messages In The Queue =====
  
 View a message'​s headers: View a message'​s headers:
  
-<sxh bash>exim -Mvh <​message-id></​sxh>+<code> 
 +exim -Mvh <​message-id>​ 
 +</code>
  
 View a message'​s body: View a message'​s body:
  
-<sxh bash>exim -Mvb <​message-id></​sxh>+<code> 
 +exim -Mvb <​message-id>​ 
 +</code>
  
 View a message'​s logs: View a message'​s logs:
  
-<sxh bash>exim -Mvl <​message-id></​sxh+<code> 
- +exim -Mvl <​message-id>​ 
-==== Queue Management ====+</code
 +\\ 
 +\\ 
 +===== Queue Management ​=====
  
 Start a queue run Start a queue run
-<sxh bash>exim -q -v</sxh>+<code> 
 +exim -q -v 
 +</code>
  
 Start a queue run for just local deliveries Start a queue run for just local deliveries
-<sxh bash>exim -ql -v</sxh>+<code> 
 +exim -ql -v 
 +</code>
  
 Remove a message from the queue Remove a message from the queue
-<sxh bash>exim -Mrm <​message-id></​sxh>+<code> 
 +exim -Mrm <​message-id>​ 
 +</code>
  
 Remove all messages older than X seconds from the queue(for example 5 days would be 432000 seconds) Remove all messages older than X seconds from the queue(for example 5 days would be 432000 seconds)
-<sxh bash>​exiqgrep -o 432000 -i | xargs exim -Mrm</sxh>+<code> 
 +exiqgrep -o 432000 -i | xargs -P25 exim -Mrm 
 +</code>
  
 Freeze all queued mail from a sender Freeze all queued mail from a sender
-<sxh bash>​exiqgrep -i -f email@address.tld | xargs exim -Mf</sxh>+<code> 
 +exiqgrep -i -f email@address.tld | xargs exim -Mf 
 +</code>
  
 View a queued message'​s header View a queued message'​s header
-<sxh bash>exim -Mvh <​message-id></​sxh>+<code> 
 +exim -Mvh <​message-id>​ 
 +</code>
  
 View a queued message'​s body View a queued message'​s body
-<sxh bash>exim -Mvb <​message-id></​sxh>+<code> 
 +exim -Mvb <​message-id>​ 
 +</code>
  
 View a queued message'​s log View a queued message'​s log
-<sxh bash>exim -Mvl <​message-id></​sxh>+<code> 
 +exim -Mvl <​message-id>​ 
 +</code>
  
 Remove all messages from the queue (usually a bad idea), note the -P25 switch passed to xargs. ​ This option tells xargs to run 25 concurrent exim removal processes. Remove all messages from the queue (usually a bad idea), note the -P25 switch passed to xargs. ​ This option tells xargs to run 25 concurrent exim removal processes.
-<sxh bash>​exiqgrep -i | xargs -P25 exim -Mrm </sxh>+<code> 
 +exiqgrep -i | xargs -P25 exim -Mrm 
 +</code> 
 + 
 +Remove all frozen messages from the queue. 
 + 
 +<​code>​ 
 +exiqgrep -iz | xargs -P25 exim -Mrm 
 +</code>
  
 +One disadvantage of using exiqgrep and xargs is that it will not start removing messages until exiqgrep prints out it's results. One solution to this the following. The disadvantage to this method is that you will be removing ALL of the email in your queue.
  
-{{tag>how-to exim smx}}+<code console> 
 +cd /​var/​spool/​exim/​msglog 
 +find . -type f -exec sh -c 'exim -Mrm `echo "​${0##​*/​}"​`'​ {\; 
 +</​code>​