SUMMARY: How to tell which config file sendmail is using

From: Christopher Barnard <cbarnar1_at_earthlink.net>
Date: Mon Nov 15 2010 - 20:16:28 EST
I asked:

> Is there a way to query the running sendmail to find out which
> sendmail.cf file it used?  I know it is usually /etc/mail/sendmail.cf,
> but there is no point in checking for custom mods, security settings,
> etc in a sendmail.cf if it is not the one in use.  Sometimes this ugly
> hack works:
>
> $ ps -ef | grep sendmail
>   root   231     1  0   Jun 09 ?       45:22 /opt/local/sbin/sendmail -bd
> -q15m
>   root  9294   231  0 12:42:53 ?        0:00 /opt/local/sbin/sendmail -bd
> -q15m
>
> $ strings /opt/local/sbin/sendmail | grep sendmail.cf
> sendmail.cf
> /opt/local/etc/mail/sendmail.cf
> $
>
> But I have seen a few instances where the full path is not visible from
> the process table.  Also human parsing was necessary above to figure out
that
> the sendmail.cf files used is in /opt/local/etc/mail...  I have not found a
> flag to
> sendmail, but perhaps I missed it.


The answer:

/fully/pathed/sendmail -d0.11 < /dev/null

I am going to try to type this from memory, since I added this to the script
this afternoon but I do not have the server in front of me...

Search for sendmail in the process table, only look for processes owned by
root and a PPID of 1

ps -ef | grep sendmail | grep root | grep -v grep | grep " 1 " | awk '{print
$9}'

Now feed the -d0.11 flag to it
`ps -ef | grep sendmail | grep root | grep -v grep | grep " 1 " | awk '{print
$9}'` -d0.11 < /dev/null

search for "Conf file" and get rid of the submit.cf  The fully qualified
sendmail.cf is all that is left, and it will be in column 3.

`ps -ef | grep sendmail | grep root | grep -v grep | grep " 1 " | awk '{print
$9}'` -d0.11 < /dev/null | grep "Conf file" | grep -v submit.cf | awk '{print
$3}'

Thanks to
	John.Hallman@wellsfargo.com
	Mazzystr <mazzystr@gmail.com>
	Salah Ali <salah.qubati@gmail.com>
	Hindley Nick <Nick.Hindley@hfbp.co.uk>
	Brad Morrison <brad.morrison@gmail.com>
	Musa Williams <musa.williams@gmail.com>
	Steven Acres <admin@swatteksystems.com>
 	Michael Nordberg <nordberg@mindspring.com>
and
	Darren Brechman-Toussaint <darren2saint@yahoo.com.au>
who corrected my sendmail syntax.  Thanks Darren.


Christopher L. Barnard
-------------------
comment your code as if the maintainer is a homicidal maniac who knows where
you live.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Mon Nov 15 20:17:38 2010

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:17 EST