Basic script for monitor send mail service

Hi All

Need help
Can any one share a basic script that is used for monitor sendmail service whether online, offline.etc in solaris

Thanks in advance
Zimmy

The most basic would be...

1) Check whether process is running

ps -ef | grep smtpd #whatever the process name

2) Check whether relay host is alive on port 25 ( The default smtp port)

telnet host 25

And proceed accordingly.. Off-course you can-not send alert mail for this. What includes in your monitoring?

Thanks for reply!!!

I just want to monitor like
If output of
bash-3.00$ svcs -a|grep sendmail
online Mar_08 svc:/network/smtp:sendmail

in this case it is online

i want script which send mail to concern team/ID whenever this service is not online
it may be either
Maintenance
offline
disable etc

Can you share the script for this :slight_smile:

May be..

$ [ "$(svcs -H -o STATE smtp)" = "online" ] && echo running || echo not running
running
$

yeah!!! that would be really helpful i guess.
Can you just send me the whole script format.so that i can run the script and check

Script is also a command ( set of commands) you just just put the above command in a file and run.

If you do want script like...

#!/usr/bin/ksh
if [ "$(svcs -H -o STATE smtp)" = "online" ]; then 
 echo running
else
 echo not running
fi