[Sunhelp] A scripting question

Jean-Marc Beaudoin jmb at merlin.vipxlnet.com
Thu Nov 25 20:12:11 CST 1999


Good day,

I try to write down a script that would check if apache is up and running.

If not, it would start it.

It's a Solaris 7 system on Intel platform.

The current script is....

#!/bin/sh
ps -ef | grep apache > $HOME/tmp.lis | wc -l $HOME/tmp.lis
if [ $? -lt 2 ] then;
	wall "Restarting Apache server"
	/etc/rc3.d/S77apachectl start
fi

To my understanding the $? should return the number of lines in tmp.lis
file.

Right now, it does not work but I think I am getting close to the
solution.

Any idea? or a better way to do this?

Regards,

Jean-Marc Beaudoin
jmbeaudoin at vipnet.qc.ca

 (-: Message  100% Unix :-)

"Unix est aujourd'hui ce que
 Windows 2018 espre tre..." 







More information about the SunHELP mailing list