Operating System - HP-UX
1833162 Members
3063 Online
110051 Solutions
New Discussion

script to check greeting line in /etc/mail/sendmail.cf

 
SOLVED
Go to solution
chicuks
Advisor

script to check greeting line in /etc/mail/sendmail.cf

script to check greeting line in /etc/mail/sendmail.cf

"O SmtpGreetingMessage= Mail Server Ready ; $b"

this script is only for checking

the script will give an output as

-if there is no greeting line present in /etc/mail/sendmail.cf it will echo "NOK"

-if there is greeting line is present then it will echo "OK".

regards
chicuks



4 REPLIES 4
Fredrik.eriksson
Valued Contributor
Solution

Re: script to check greeting line in /etc/mail/sendmail.cf

Something like this might do the trick.

#!/bin/bash
grep "O SmtpGreetingMessage= Mail Server Ready ; \$b" /etc/mail/sendmail.cf &> /dev/null
if [ $? -eq 0 ]; then
echo OK
else
echo NOK
fi

If I remember correctly grep returns 0 if it matches something, else it returns a higher return number (unsure if it's 1 or higher).

Best regards
Fredrik Eriksson
James R. Ferguson
Acclaimed Contributor

Re: script to check greeting line in /etc/mail/sendmail.cf

Hi:

> script to check greeting line in /etc/mail/sendmail.cf

MANY of your questions are really the SAME question re-framed --- "...script to check..."; "...this script is only for checking"; "...echo 'NOK'...echo 'OK'."

I suggest that you re-read the answers to the questions like this one that you have already asked. You should begin to see a pattern to the simple solutions offered.

I suggest too, that you get a book or two on Shell scripting. It is a fundamental requirement for any good system administrator. For a start, see:

http://docs.hp.com/en/B2355-90046/B2355-90046.pdf

Don't use the c-shell ('csh') nor worry about the Bourne shell. Concentrate on the Posix/Korn syntax which extends too to the GNU Bash shell if/as you use it.

Regards!

...JRF...
TTr
Honored Contributor

Re: script to check greeting line in /etc/mail/sendmail.cf

I agree with JRF. A casual help with a scripting issue is OK but this is no longer casual help, it is us doing your job and you are getting paid. This is NOK. You have to put some effort into it.
chicuks
Advisor

Re: script to check greeting line in /etc/mail/sendmail.cf

thanx