Linux Training

Linux training for private, public & voluntary sector.

0793 572 8612

City LinUX sample scripts - rmq


rmq - checks the mail queue on a remote server.


rmq [ -c <config> ] [ -d ] [ -v ] [ -V ] < clientid >


rmq is a Bourne shell script which should work equally well on all versions of UNIX, Linux and Mac OS X.


rmq uses ssh and sudo where necessary to return a summary of the current mail queue on a remote server. The configuration file ( /usr/local/etc/ by default) is used to determine the mail transfer agent on the remote host and relevant hostname using the " client id " supplied on the command line. If the configuration file does not exist or there is no entry for the client id supplied, rmq will assume that " client id " = " hostname ".

The script assumes that trying to use root to probe remote systems will lead to problems so attempts to run with an id less than 500 cause an error and the script terminates.


-c    <config_file> Use the named configuration file in preference to the default " /usr/local/etc/ ".

-d    Start in debug mode. The script will run in a shell with the -x    option set.

-l    The summary returned is logged using the local syslog facility. This is particularly useful for compiling reports on the number of checks made and facilitates calculation of the average queue length.

-v    Set verbose mode. Ordinarily rmq operates silently unless problems are detected. In verbose mode rmq reports on each significant action and returns a list of items in the queue.

-V    Print version details and exit.


rmq -l  billpayers

Using the client id " billpayers " as the look up key, rmq will extract the details of the remote host and mail transport agent being used.


.IR /usr/local/etc/


The script has more error checking than most but is still quite crude having been developed to resolve specific client issues. File permissions are critical and sudo is be used execute commands where root privileges are required.


backup, chkftpd, chkfw, chkup, report, rhost.


Clifford W Fulford, City Linux. Contact or +44 (0)709 229 5385.

The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.