run a command automatically after every 10 mins

Hi friends,

I need to write a script which runs a command (on that particular server only) after every 10 mins, and the contents are also echoed on that very terminal only.
And then I need to compare the last two outputs, and mail if there is any difference in the last two outputs.
Can we set some alerts, say a machine beeps if the last two outputs have some difference.
Thats my total job.

I think I can do the rest part of it,

BUT

first I want to know how can I run a command automatically after every 10 mins, and dislpay its contents on the terminal.

Pls help, I am a newbie still learning.

Thanks in adv.

Regards,
Vikas

You can try the following method :

yes "date; sleep 10"|sh &  # display date every ten seconds

or

$ cat date.sh
while true
do
   date
   sleep 10
done
$ date.sh &

Jean-Pierre.

check if this works for you:

watch -10 "your_command"

man watch for details

addition: to automate this task, you may setup a cron job to run a script every 10 minutes

Hi Yogesh,

there is no watch command in Sun Os (Solaris).

Any other idea.

Thanks

Capture the outputs and use "diff" to check for the difference.

You can send a terminal a bell character ASCII 0x07,

echo \\0007