Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Is it actually stopped, or has it died (was killed)? There's a huge difference in UNIX world between those two states... – Hubert Kario Jan 7 '12 at 15:09
One more thing: checking why it crashed will be much more productive. Check logs. It also may be a sign of some other problem (faulty RAM). – Hubert Kario Jan 7 '12 at 15:14

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.

share|improve this answer
typeset -i RC
rcgrpwise status >dev/null 2>&1
let RC=$?
if [ $RC -ne 0 ]
     rcpgrwise restart
sleep 3
rcgrpwise status >/dev/null 2>&1
exit $?

Save this as script and call it from cron.

or shorter:

rcgrpwise status >/dev/null 2>&1 || rcgrpwise restart

But as others have stated - you should research why this is stalling.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.