Previous   Next   Contents       (Exim 4.50 Specification)

49. Exim utilities

A number of utility scripts and programs are supplied with Exim and are described in this chapter. There is also the Exim Monitor, which is covered in the next chapter. The utilities described here are:

  49.1 exiwhat  list what Exim processes are doing
  49.2 exiqgrep  grep the queue
  49.3 exiqsumm  summarize the queue
  49.4 exigrep  search the main log
  49.5 exipick  select messages on various criteria
  49.6 exicyclog  cycle (rotate) log files
  49.7 eximstats  extract statistics from the log
  49.8 exim_checkaccess  check address acceptance from given IP
  49.9 exim_dbmbuild  build a DBM file
  49.10 exinext  extract retry information
  49.11 exim_dumpdb  dump a hints database
  49.11 exim_tidydb  clean up a hints database
  49.11 exim_fixdb  patch a hints database
  49.15 exim_lock  lock a mailbox file

49.1 Finding out what Exim processes are doing (exiwhat)

On operating systems that can restart a system call after receiving a signal (most modern OS), an Exim process responds to the SIGUSR1 signal by writing a line describing what it is doing to the file exim-process.info in the Exim spool directory. The exiwhat script sends the signal to all Exim processes it can find, having first emptied the file. It then waits for one second to allow the Exim processes to react before displaying the results. In order to run exiwhat successfully you have to have sufficient privilege to send the signal to the Exim processes, so it is normally run as root.

Warning: This is not an efficient process. It is intended for occasional use by system administrators. It is not sensible, for example, to set up a script that sends SIGUSR1 signals to Exim processes at short intervals.

Unfortunately, the ps command that exiwhat uses to find Exim processes varies in different operating systems. Not only are different options used, but the format of the output is different. For this reason, there are some system configuration options that configure exactly how exiwhat works. If it doesn't seem to be working for you, check the following compile-time options:

  EXIWHAT_PS_CMD the command for running ps
  EXIWHAT_PS_ARG the argument for ps
  EXIWHAT_EGREP_ARG the argument for egrep to select from ps output
  EXIWHAT_KILL_ARG the argument for the kill command

An example of typical output from exiwhat is

   164 daemon: -q1h, listening on port 25
  10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
  10492 delivering 0tAycK-0002ij-00 to mail.ref.example [10.19.42.42]
   (editor@ref.example)
  10592 handling incoming call from [192.168.243.242]
  10628 accepting a local non-SMTP message

The first number in the output line is the process number. The third line has been split here, in order to fit it on the page.

49.2 Selective queue listing (exiqgrep)

This utility is a Perl script contributed by Matt Hubbard. It runs

  exim -bpu

to obtain a queue listing with undelivered recipients only, and then greps the output to select messages that match given criteria. The following selection options are available:


-f <regex>

Match the sender address. The field that is tested is enclosed in angle brackets, so you can test for bounce messages with

  exiqgrep -f '^<>$'

-r <regex>

Match a recipient address. The field that is tested is not enclosed in angle brackets.


-s <regex>

Match against the size field.


-y <seconds>

Match messages that are younger than the given time.


-o <seconds>

Match messages that are older than the given time.


-z

Match only frozen messages.


-x

Match only non-frozen messages.



The following options control the format of the output:


-c

Display only the count of matching messages.


-l

Long format – display the full message information as output by Exim. This is the default.


-i

Display message ids only.


-b

Brief format – one line per message.


-R

Display messages in reverse order.



There is one more option, -h, which outputs a list of options.

49.3 Summarising the queue (exiqsumm)

The exiqsumm utility is a Perl script which reads the output of exim -bp and produces a summary of the messages on the queue. Thus, you use it by running a command such as

  exim -bp | exiqsumm

The output consists of one line for each domain that has messages waiting for it, as in the following example:

    3   2322   74m   66m  msn.com.example

Each line lists the number of pending deliveries for a domain, their total volume, and the length of time that the oldest and the newest messages have been waiting. Note that the number of pending deliveries is greater than the number of messages when messages have more than one recipient.

A summary line is output at the end. By default the output is sorted on the domain name, but exiqsumm has the options -a and -c, which cause the output to be sorted by oldest message and by count of messages, respectively.

The output of exim -bp contains the original addresses in the message, so this also applies to the output from exiqsumm. No domains from addresses generated by aliasing or forwarding are included (unless the one_time option of the redirect router has been used to convert them into “top level” addresses).

49.4 Extracting specific information from the log (exigrep)

The exigrep utility is a Perl script that searches one or more main log files for entries that match a given pattern. When it finds a match, it extracts all the log entries for the relevant message, not just those that match the pattern. Thus, exigrep can extract complete log entries for a given message, or all mail for a given user, or for a given host, for example.

If a matching log line is not associated with a specific message, it is always included in exigrep's output. The usage is:

  exigrep [-l] [-t<n>] <pattern> [<log file>] ...

The -t argument specifies a number of seconds. It adds an additional condition for message selection. Messages that are complete are shown only if they spent more than <n> seconds on the queue.

The -l flag means “literal”, that is, treat all characters in the pattern as standing for themselves. Otherwise the pattern must be a Perl regular expression. The pattern match is case-insensitive. If no file names are given on the command line, the standard input is read.

If the location of a zcat command is known from the definition of ZCAT_COMMAND in Local/Makefile, exigrep automatically passes any file whose name ends in COMPRESS_SUFFIX through zcat as it searches it.

49.5 Selecting messages by various criteria (exipick)

John Jetmore's exipick utility is included in the Exim distribution. It lists messages from the queue according to a variety of criteria. For details, run:

  exipick --help

49.6 Cycling log files (exicyclog)

The exicyclog script can be used to cycle (rotate) mainlog and rejectlog files. This is not necessary if only syslog is being used, or if you are using log files with datestamps in their names (see section 48.3). Some operating systems have their own standard mechanisms for log cycling, and these can be used instead of exicyclog if preferred.

Each time exicyclog is run the file names get “shuffled down” by one. If the main log file name is mainlog (the default) then when exicyclog is run mainlog becomes mainlog.01, the previous mainlog.01 becomes mainlog.02 and so on, up to a limit which is set in the script, and which defaults to 10. Log files whose numbers exceed the limit are discarded. Reject logs are handled similarly.

If the limit is greater than 99, the script uses 3-digit numbers such as mainlog.001, mainlog.002, etc. If you change from a number less than 99 to one that is greater, or vice versa, you will have to fix the names of any existing log files.

If no mainlog file exists, the script does nothing. Files that “drop off” the end are deleted. All files with numbers greater than 01 are compressed, using a compression command which is configured by the COMPRESS_COMMAND setting in Local/Makefile. It is usual to run exicyclog daily from a root crontab entry of the form

  1 0 * * * su exim -c /usr/exim/bin/exicyclog

assuming you have used the name “exim” for the Exim user. You can run exicyclog as root if you wish, but there is no need.

49.7 Mail statistics (eximstats)

A Perl script called eximstats is provided for extracting statistical information from log files. The output is either plain text, or HTML. Exim log files are also suported by the Lire system produced by the LogReport Foundation (http://www.logreport.org).

The eximstats script has been hacked about quite a bit over time. The latest version is the result of some extensive revision by Steve Campbell. A lot of information is given by default, but there are options for suppressing various parts of it. Following any options, the arguments to the script are a list of files, which should be main log files. For Selective queue listing (exiqgrep)

This utility is a Perl script contributed by Matt Hubbard. It runs

  exim -bpu

to obtain a queue listing with undelivered recipients only, and then greps the output to select messages that match given criteria. The following selection options are available:


-f <regex>

Match the sender address. The field that is tested is enclosed in angle brackets, so you can test for bounce messages with

  exiqgrep -f '^<>$'

-r <regex>

Match a recipient address. The field that is tested is not enclosed in angle brackets.


-s <regex>

Match against the size field.


-y <seconds>

Match messages that are younger than the given time.


-o <seconds>

Match messages that are older than the given time.


-z

Match only frozen messages.


-x

Match only non-frozen messages.



The following options control the format of the output:


-c

Display only the count of matching messages.


-l

Long format – display the full message information as output by Exim. This is the default.


-i

Display message ids only.


-b

Brief format – one line per message.


-R

Display messages in reverse order.



There is one more option, -h, which outputs a list of options.

49.3 Summarising the queue (exiqsumm)

The exiqsumm utility is a Perl script which reads the output of exim -bp and produces a summary of the messages on the queue. Thus, you use it by running a command such as

  exim -bp | exiqsumm

The output consists of one line for each domain that has messages waiting for it, as in the following example:

    3   2322   74m   66m  msn.com.example

Each line lists the number of pending deliveries for a domain, their total volume, and the length of time that the oldest and the newest messages have been waiting. Note that the number of pending deliveries is greater than the number of messages when messages have more than one recipient.

A summary line is output at the end. By default the output is sorted on the domain name, but exiqsumm has the options -a and -c, which cause the output to be sorted by oldest message and by count of messages, respectively.

The output of exim -bp contains the original addresses in the message, so this also applies to the output from exiqsumm. No domains from addresses generated by aliasing or forwarding are included (unless the one_time option of the redirect router has been used to convert them into “top level” addresses).

49.4 Extracting specific information from the log (exigrep)

The exigrep utility is a Perl script that searches one or more main log files for entries that match a given pattern. When it finds a match, it extracts all the log entries for the relevant message, not just those that match the pattern. Thus, exigrep can extract complete log entries for a given message, or all mail for a given user, or for a given host, for example.

If a matching log line is not associated with a specific message, it is always included in exigrep's output. The usage is:

  exigrep [-l] [-t<n>] <pattern> [<log file>] ...

The -t argument specifies a number of seconds. It adds an additional condition for message selection. Messages that are complete are shown only if they spent more than <n> seconds on the queue.

The -l flag means “literal”, that is, treat all characters in the pattern as standing for themselves. Otherwise the pattern must be a Perl regular expression. The pattern match is case-insensitive. If no file names are given on the command line, the standard input is read.

If the location of a zcat command is known from the definition of ZCAT_COMMAND in Local/Makefile, exigrep automatically passes any file whose name ends in COMPRESS_SUFFIX through zcat as it searches it.

49.5 Selecting messages by various criteria (exipick)

John Jetmore's exipick utility is included in the Exim distribution. It lists messages from the queue according to a variety of criteria. For details, run:

  exipick --help

49.6 Cycling log files (exicyclog)

The exicyclog script can be used to cycle (rotate) mainlog and rejectlog files. This is not necessary if only syslog is being used, or if you are using log files with datestamps in their names (see section 48.3). Some operating systems have their own standard mechanisms for log cycling, and these can be used instead of exicyclog if preferred.

Each time exicyclog is run the file names get “shuffled down” by one. If the main log file name is mainlog (the default) then when exicyclog is run mainlog becomes mainlog.01, the previous mainlog.01 becomes mainlog.02 and so on, up to a limit which is set in the script, and which defaults to 10. Log files whose numbers exceed the limit are discarded. Reject logs are handled similarly.

If the limit is greater than 99, the script uses 3-digit numbers such as mainlog.001, mainlog.002, etc. If you change from a number less than 99 to one that is greater, or vice versa, you will have to fix the names of any existing log files.

If no mainlog file exists, the script does nothing. Files that “drop off” the end are deleted. All files with numbers greater than 01 are compressed, using a compression command which is configured by the COMPRESS_COMMAND setting in Local/Makefile. It is usual to run exicyclog daily from a root crontab entry of the form

  1 0 * * * su exim -c /usr/exim/bin/exicyclog

assuming you have used the name “exim” for the Exim user. You can run exicyclog as root if you wish, but there is no need.

49.7 Mail statistics (eximstats)

A Perl script called eximstats is provided for extracting statistical information from log files. The output is either plain text, or HTML. Exim log files are also suported by the Lire system produced by the LogReport Foundation (http://www.logreport.org).

The eximstats script has been hacked about quite a bit over time. The latest version is the result of some extensive revision by Steve Campbell. A lot of information is given by default, but there are options for suppressing various parts of it. Following any options, the arguments to the script are a list of files, which should be main log files. For Selective queue listing (exiqgrep)

This utility is a Perl script contributed by Matt Hubbard. It runs

  exim -bpu

to obtain a queue listing with undelivered recipients only, and then greps the output to select messages that match given criteria. The following selection options are available:


-f <regex>

Match the sender address. The field that is tested is enclosed in angle brackets, so you can test for bounce messages with

  exiqgrep -f '^<>$'

-r <regex>

Match a recipient address. The field that is tested is not enclosed in angle brackets.


-s <regex>

Match against the size field.


-y <seconds>

Match messages that are younger than the given time.


-o <seconds>

Match messages that are older than the given time.


-z

Match only frozen messages.


-x

Match only non-frozen messages.



The following options control the format of the output:


-c

Display only the count of matching messages.


-l

Long format – display the full message information as output by Exim. This is the default.


-i

Display message ids only.


-b

Brief format – one line per message.


-R

Display messages in reverse order.



There is one more option, -h, which outputs a list of options.

49.3 Summarising the queue (exiqsumm)

The exiqsumm utility is a Perl script which reads the output of exim -bp and produces a summary of the messages on the queue. Thus, you use it by running a command such as

  exim -bp | exiqsumm

The output consists of one line for each domain that has messages waiting for it, as in the following example:

    3   2322   74m   66m  msn.com.example

Each line lists the number of pending deliveries for a domain, their total volume, and the length of time that the oldest and the newest messages have been waiting. Note that the number of pending deliveries is greater than the number of messages when messages have more than one recipient.

A summary line is output at the end. By default the output is sorted on the domain name, but exiqsumm has the options -a and -c, which cause the output to be sorted by oldest message and by count of messages, respectively.

The output of exim -bp contains the original addresses in the message, so this also applies to the output from exiqsumm. No domains from addresses generated by aliasing or forwarding are included (unless the one_time option of the redirect router has been used to convert them into “top level” addresses).

49.4 Extracting specific information from the log (exigrep)

The exigrep utility is a Perl script that searches one or more main log files for entries that match a given pattern. When it finds a match, it extracts all the log entries for the relevant message, not just those that match the pattern. Thus, exigrep can extract complete log entries for a given message, or all mail for a given user, or for a given host, for example.

If a matching log line is not associated with a specific message, it is always included in exigrep's output. The usage is:

  exigrep [-l] [-t<n>] <pattern> [<log file>] ...

The -t argument specifies a number of seconds. It adds an additional condition for message selection. Messages that are complete are shown only if they spent more than <n> seconds on the queue.

The -l flag means “literal”, that is, treat all characters in the pattern as standing for themselves. Otherwise the pattern must be a Perl regular expression. The pattern match is case-insensitive. If no file names are given on the command line, the standard input is read.

If the location of a zcat command is known from the definition of ZCAT_COMMAND in Local/Makefile, exigrep automatically passes any file whose name ends in COMPRESS_SUFFIX through zcat as it searches it.

49.5 Selecting messages by various criteria (exipick)

John Jetmore's exipick utility is included in the Exim distribution. It lists messages from the queue according to a variety of criteria. For details, run:

  exipick --help

49.6 Cycling log files (exicyclog)

The exicyclog script can be used to cycle (rotate) mainlog and rejectlog files. This is not necessary if only syslog is being used, or if you are using log files with datestamps in their names (see section 48.3). Some operating systems have their own standard mechanisms for log cycling, and these can be used instead of exicyclog if preferred.

Each time exicyclog is run the file names get “shuffled down” by one. If the main log file name is mainlog (the default) then when exicyclog is run mainlog becomes mainlog.01, the previous mainlog.01 becomes mainlog.02 and so on, up to a limit which is set in the script, and which defaults to 10. Log files whose numbers exceed the limit are discarded. Reject logs are handled similarly.

If the limit is greater than 99, the script uses 3-digit numbers such as mainlog.001, mainlog.002, etc. If you change from a number less than 99 to one that is greater, or vice versa, you will have to fix the names of any existing log files.

If no mainlog file exists, the script does nothing. Files that “drop off” the end are deleted. All files with numbers greater than 01 are compressed, using a compression command which is configured by the COMPRESS_COMMAND setting in Local/Makefile. It is usual to run exicyclog daily from a root crontab entry of the form

  1 0 * * * su exim -c /usr/exim/bin/exicyclog

assuming you have used the name “exim” for the Exim user. You can run exicyclog as root if you wish, but there is no need.

49.7 Mail statistics (eximstats)

A Perl script called eximstats is provided for extracting statistical information from log files. The output is either plain text, or HTML. Exim log files are also suported by the Lire system produced by the LogReport Foundation (http://www.logreport.org).

The eximstats script has been hacked about quite a bit over time. The latest version is the result of some extensive revision by Steve Campbell. A lot of information is given by default, but there are options for suppressing various parts of it. Following any options, the arguments to the script are a list of files, which should be main log files. For Selective queue listing (exiqgrep)

This utility is a Perl script contributed by Matt Hubbard. It runs

  exim -bpu

to obtain a queue listing with undelivered recipients only, and then greps the output to select messages that match given criteria. The following selection options are available:


-f <regex>

Match the sender address. The field that is tested is enclosed in angle brackets, so you can test for bounce messages with

  exiqgrep -f '^<>$'

-r <regex>

Match a recipient address. The field that is tested is not enclosed in angle brackets.


-s <regex>

Match against the size field.


-y <seconds>

Match messages that are younger than the given time.


-o <seconds>

Match messages that are older than the given time.


-z

Match only frozen messages.


-x

Match only non-frozen messages.



The following options control the format of the output:


-c

Display only the count of matching messages.


-l

Long format – display the full message information as output by Exim. This is the default.


-i

Display message ids only.


-b

Brief format – one line per message.


-R

Display messages in reverse order.



There is one more option, -h, which outputs a list of options.

49.3 Summarising the queue (exiqsumm)

The exiqsumm utility is a Perl script which reads the output of exim -bp and produces a summary of the messages on the queue. Thus, you use it by running a command such as

  exim -bp | exiqsumm

The output consists of one line for each domain that has messages waiting for it, as in the following example:

    3   2322   74m   66m  msn.com.example

Each line lists the number of pending deliveries for a domain, their total volume, and the length of time that the oldest and the newest messages have been waiting. Note that the number of pending deliveries is greater than the number of messages when messages have more than one recipient.

A summary line is output at the end. By default the output is sorted on the domain name, but exiqsumm has the options -a and -c, which cause the output to be sorted by oldest message and by count of messages, respectively.

The output of exim -bp contains the original addresses in the message, so this also applies to the output from exiqsumm. No domains from addresses generated by aliasing or forwarding are included (unless the one_time option of the redirect router has been used to convert them into “top level” addresses).

49.4 Extracting specific information from the log (exigrep)

The exigrep utility is a Perl script that searches one or more main log files for entries that match a given pattern. When it finds a match, it extracts all the log entries for the relevant message, not just those that match the pattern. Thus, exigrep can extract complete log entries for a given message, or all mail for a given user, or for a given host, for example.

If a matching log line is not associated with a specific message, it is always included in exigrep's output. The usage is:

  exigrep [-l] [-t<n>] <pattern> [<log file>] ...

The -t argument specifies a number of seconds. It adds an additional condition for message selection. Messages that are complete are shown only if they spent more than <n> seconds on the queue.

The -l flag means “literal”, that is, treat all characters in the pattern as standing for themselves. Otherwise the pattern must be a Perl regular expression. The pattern match is case-insensitive. If no file names are given on the command line, the standard input is read.

If the location of a zcat command is known from the definition of ZCAT_COMMAND in Local/Makefile, exigrep automatically passes any file whose name ends in COMPRESS_SUFFIX through zcat as it searches it.

49.5 Selecting messages by various criteria (exipick)

John Jetmore's exipick utility is included in the Exim distribution. It lists messages from the queue according to a variety of criteria. For details, run:

  exipick --help

49.6 Cycling log files (exicyclog)

The exicyclog script can be used to cycle (rotate) mainlog and rejectlog files. This is not necessary if only syslog is being used, or if you are using log files with datestamps in their names (see section 48.3). Some operating systems have their own standard mechanisms for log cycling, and these can be used instead of exicyclog if preferred.

Each time exicyclog is run the file names get “shuffled down” by one. If the main log file name is mainlog (the default) then when exicyclog is run mainlog becomes mainlog.01, the previous mainlog.01 becomes mainlog.02 and so on, up to a limit which is set in the script, and which defaults to 10. Log files whose numbers exceed the limit are discarded. Reject logs are handled similarly.

If the limit is greater than 99, the script uses 3-digit numbers such as mainlog.001, mainlog.002, etc. If you change from a number less than 99 to one that is greater, or vice versa, you will have to fix the names of any existing log files.

If no mainlog file exists, the script does nothing. Files that “drop off” the end are deleted. All files with numbers greater than 01 are compressed, using a compression command which is configured by the COMPRESS_COMMAND setting in Local/Makefile. It is usual to run exicyclog daily from a root crontab entry of the form

  1 0 * * * su exim -c /usr/exim/bin/exicyclog

assuming you have used the name “exim” for the Exim user. You can run exicyclog as root if you wish, but there is no need.

49.7 Mail statistics (eximstats)

A Perl script called eximstats is provided for extracting statistical information from log files. The output is either plain text, or HTML. Exim log files are also suported by the Lire system produced by the LogReport Foundation (http://www.logreport.org).

The eximstats script has been hacked about quite a bit over time. The latest version is the result of some extensive revision by Steve Campbell. A lot of information is given by default, but there are options for suppressing various parts of it. Following any options, the arguments to the script are a list of files, which should be main log files. For Selective queue listing (exiqgrep)

This utility is a Perl script contributed by Matt Hubbard. It runs

  exim -bpu

to obtain a queue listing with undelivered recipients only, and then greps the output to select messages that match given criteria. The following selection options are available:


-f <regex>

Match the sender address. The field that is tested is enclosed in angle brackets, so you can test for bounce messages with

  exiqgrep -f '^<>$'

-r <regex>

Match a recipient address. The field that is tested is not enclosed in angle brackets.


-s <regex>

Match against the size field.


-y <seconds>

Match messages that are younger than the given time.


-o <seconds>

Match messages that are older than the given time.


-z

Match only frozen messages.


-x

Match only non-frozen messages.



The following options control the format of the output:


-c

Display only the count of matching messages.


-l

Long format – display the full message information as output by Exim. This is the default.


-i

Display message ids only.


-b

Brief format – one line per message.


-R

Display messages in reverse order.



There is one more option, -h, which outputs a list of options.

49.3 Summarising the queue (exiqsumm)

The exiqsumm utility is a Perl script which reads the output of exim -bp and produces a summary of the messages on the queue. Thus, you use it by running a command such as

  exim -bp | exiqsumm

The output consists of one line for each domain that has messages waiting for it, as in the following example:

    3   2322   74m   66m  msn.com.example

Each line lists the number of pending deliveries for a domain, their total volume, and the length of time that the oldest and the newest messages have been waiting. Note that the number of pending deliveries is greater than the number of messages when messages have more than one recipient.

A summary line is output at the end. By default the output is sorted on the domain name, but exiqsumm has the options -a and -c, which cause the output to be sorted by oldest message and by count of messages, respectively.

The output of exim -bp contains the original addresses in the message, so this also applies to the output from exiqsumm. No domains from addresses generated by aliasing or forwarding are included (unless the one_time option of the redirect router has been used to convert them into “top level” addresses).

49.4 Extracting specific information from the log (exigrep)

The exigrep utility is a Perl script that searches one or more main log files for entries that match a given pattern. When it finds a match, it extracts all the log entries for the relevant message, not just those that match the pattern. Thus, exigrep can extract complete log entries for a given message, or all mail for a given user, or for a given host, for example.

If a matching log line is not associated with a specific message, it is always included in exigrep's output. The usage is:

&nbs