sendmailSearch this book
Previous: 38.2 Configuration LinesChapter 38
Rule-Set Testing with -bt
Next: 38.4 Show an Item

38.3 Dump a Macro

Beginning with V8.7, the new rule testing commands allow you to print the value of a defined macro and the members of a class. With either command, you may use single-character or multicharacter macro names. Both commands begin with a $ character. An error is caused if nothing follows that $:

Name required for macro/class

If an = character follows, sendmail will display the requested class. Otherwise, the value of the macro is displayed:

$X              <- display the value of the X macro
$=X             <- list the members of the class X

38.3.1 Dump a Defined Macro with $

The $ rule-testing command causes sendmail to print the value of a defined macro. The form for this command looks like this:

$X               <- show value of the single character macro name X
${YYY}           <- show value of the multi-character macro name YYY

Only one macro may be listed per line. If more than one is listed, all but the first is ignored:

$X $Y

One use for this command might be in solving the problem of duplicate domains. For example, suppose you just installed a new configuration file and discovered that your host was no longer known as here.our.domain but instead wrongly had an extra domain attached like this: here.our.domain.our.domain. To check the value of $j (see Section 31.10.20, $j), which should contain the canonical name of your host, you could run sendmail in rule-testing mode:

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> $j

This looks right because $w (see Section 31.10.40, $w) is supposed to contain our short hostname. But just to check, you could also print the value of $w:

> $w

Aha! Somehow, $w got the full canonical name. A quick scan of your .mc file (see Section 19.2, "Build with m4") turns up this error:

Dwhere.our.domain           # $w is supposed to be full - joachim

Apparently, your assistant, Joachim, mistakenly thought that new sendmail was wrong. By deleting the offending line and creating a new configuration file, you can take care of the problem.

38.3.2 Dump a Class Macro with $=

The $= rule-testing command tells sendmail to print all the members for a class. The class name must immediately follow the = with no intervening space, or the name is ignored. Both single-character and multicharacter names may be used:

$= X            <- the X is ignored
$=X             <- list the members of the class X
$={xxx}         <- list the members of the class xxx

The list of members (if any) is printed one per line:

> $=w

To illustrate one use for this command, imagine that you just made the local host the FTP server for your site. Of course, you were careful to modify the configuration file and add fax and fax.our.domain to the $=w class in it. But incoming mail to fax.our.domain is still failing. You run sendmail in rule-testing mode, as above, to verify that the correct entries are in $=w:

fax                    <- correct
fax.our.domain         <- correct

Since they are correct, it could be that you made the mistake of changing the configuration file and failing to restart the daemon (see Section 4.1.1, "Daemon Mode (-bd)"). The following command line fixes the problem (see Section 26.3.2, "SIGHUP Restart"):

# kill -HUP `head -1 /etc/`

Previous: 38.2 Configuration LinessendmailNext: 38.4 Show an Item
38.2 Configuration LinesBook Index38.4 Show an Item