This is in AIX 5.3..Need a script to start th process every time goes down

This is in aix 5.3..The sendmail daemon goes down quite often,I need a script to bring it up every time it goes down
the comand to bring up the sendmail..This is I am doing manually evertytime it goes down

starsrc -s sendmail -a "-bd"  ..Please let me know as how to automate it as whenever it goes down

ps -ef | grep sendmail
    root  258148  176254   0   Nov 09      -  0:00 sendmail: accepting connections
aixtutorialAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
Sorry, the sequence of the greps is wrong -
* * * * * ps -ef | grep -v "grep" | grep -q "sendmail:" ||  startsrc -s sendmail -a "-bd -q30m"
0
 
woolmilkporcCommented:
I'd rather do some research to find out why sendmail might die that often
Isn't there anything in errpt?
Anyway, create an entry like this in root's crontab to check every minute for sendmail and restart it if it's not there.
* * * * * ps -ef | grep -q "sendmail:" | grep -v "grep" ||  startsrc -s sendmail -a "-bd -q30m"
wmp
0
 
omarfaridCommented:
look into inittab to see how to run this:

http://linux.die.net/man/5/inittab
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
woolmilkporcCommented:
omarfarid,
AIX's sendmail is not started from inittab but from /etc/rc.tcpip.
Adding it to inittab with "respawn" would break AIX standards, which I don't recommend here.
wmp
0
 
omarfaridCommented:
That is understood, but if you want to use crontab then there will be one min gap, while inittab can do better.

An alternative, is to have a script running at system startup and that script loops for ever and it monitors the sendmail as you showed above. One problem here, is that you need to make sure that this script does not die or hangs !
0
 
balasundaram_sCommented:
Anyhow this is not relevant to your question, but I may guess that sendmail going down could be due to DNS issue.
0
All Courses

From novice to tech pro — start learning today.