while loop and delay

Dear all,

if we want to run a command every 5 mins to check if the process is working fine or not...

like in c, we can use a simple while loop with a delay for 5 mins...

how can we accomplish this is solaris 8/9

thanks

br/asad

Use the sleep command:

sleep 300

Regards

You can do something like that :

while :
   command
   sleep 300
done

or

yes 'command; sleep 500' | /usr/bin/sh

basically i wanna do this : but it isnt working

while (1)
{
command;
sleep 100;
}

This is not a script shell syntax.

Try

while /usr/bin/true
do
   command
   sleep 100
done

or

while :
do
   command
   sleep 100
done

thanks its worked!!! :):slight_smile: