LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-01-2007, 06:39 AM   #1
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Question 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
 
Old 11-01-2007, 06:51 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
while command; do sleep 600;done

or more resilient to errors:

Code:
command
while sleep 600;do
command
done
 
Old 11-01-2007, 06:54 AM   #3
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by bigearsbilly View Post
while command; do sleep 600;done

or more resilient to errors:

Code:
command
while sleep 600;do
command
done






Thanks Billy, will try it tonight and get back to you.
 
Old 08-03-2008, 05:37 PM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Original Poster
Rep: Reputation: 107Reputation: 107
Smile

This also works fine.

Code:
yes "command; sleep 600" | sh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to re-run a command every x seconds automatically? Akhran Linux - Newbie 4 08-22-2006 10:58 PM
Run Command on boot automatically qqcoisa Linux - Hardware 1 03-20-2006 12:27 AM
How to run a command automatically on start up TKD SUSE / openSUSE 6 11-03-2005 04:41 AM
How can I run a command automatically at startup? luwigie Linux - General 8 08-26-2004 09:05 PM
How do I get Fedora to automatically run a command during startup? jlsain Linux - Software 2 03-23-2004 04:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration