Process management


I desperately need some help here...
I need to write a shellscript that lists all running processes (as in ps -ef), search the list it gets for occurances of a certain process, if found do nothing if not found start it again.
Anyone feel up to it?


Try something like:


ps -ef | grep [f]oo
if [ $? -eq 1 ]
	echo Process not running.
	# Restart process here

Replace 'foo' with whatever your process name is. The
[ ] brackets around the first letter will stop grep from matching on itself.