Running a linux script to check on process and if stopped how to make it start the process

novellscripting

We are running OES2/SuSE. The problem is with our groupwise webaccess. From time to time it stops and we just have to restart the process. The commands are:

rcgrpwise status
rcgrpwise start

How would I create a script that would check the status and if it comes back stopped, then it would run the rcgrpwise start command.

Best Answer

If it's a really simple process to start I would probably add it to inittab with a respawn entry. Otherwise look at using something like monit to check and automatically restart processes.