Check sendmail is not receiving any emails

Hi all,
Need some advise again. I am new to sendmail service which is already configured by some other administrators. I would need to write a script to check whether sendmail service is enabled in Solaris and Linux.
Using this command "ps -ef | grep sendmail | grep -v grep".
Or is there any better command?
The above command will give me a line with "-q15m".

The problem is i need to check that this service is only for delivering emails and Not for receiving any emails. 

How do i go about writing the script for Solaris and Linux?

Thank you in advance for some advice.

Any help from somebody?

Dear Kinki,

Please do not "bump up" your posts. This is a rule violation. Thank you.

As far as your question, here is the code I use in the crontab file for sendmail to make sure it *IS* running:

www# cat checksendmail
#!/usr/bin/perl

open(PS,"/bin/ps x|") || die "Can't Open PS";
while(<PS>) {
if (/sendmail: accepting/) { close PS; exit;}
}
close PS;
system("/usr/lib/sendmail -bd -q5m");

You can easily modify my little script to make sure sendmail is *NOT* running....

Neo

Hi Neo,
Thank you for your reply. Sorry, i don't understand the word "bump up", do u mean my second reply? So sorry..

Sorry i don't use perl in my script. Just ordinary #!/bin/sh.

What is the alternative commands in this case?

Dear Kinki,

I do not use #!/bin/sh in scripts for over 8 years, maybe longer.

Personally, I like more powerful scripting languages.

Having said that, you should easily be able to write one yourself - the same way we all learned, by trial-and-error.

Neo

hmm, what does PS referring to in the command?

Is is simply the name of a file descriptor.

You man find this on your system with the command:

man perlintro

 You can open a file for input or output using the "open()" function.  It's
       documented in extravagant detail in perlfunc and perlopentut, but in
       short:

           open(INFILE,  "input.txt")   or die "Can't open input.txt: $!";
           open(OUTFILE, ">output.txt") or die "Can't open output.txt: $!";
           open(LOGFILE, ">>my.log")    or die "Can't open logfile: $!";