run a command automatically after every 10 mins


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting run a command automatically after every 10 mins
# 1  
Old 11-01-2007
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
# 2  
Old 11-01-2007
You can try the following method :
Code:
yes "date; sleep 10"|sh &  # display date every ten seconds

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


Jean-Pierre.
# 3  
Old 11-01-2007
check if this works for you:
Code:
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

Last edited by Yogesh Sawant; 11-01-2007 at 09:27 AM.. Reason: added note about cron
# 4  
Old 11-01-2007
Data

Quote:
Originally Posted by Yogesh Sawant
check if this works for you:
Code:
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
# 5  
Old 11-01-2007
Capture the outputs and use "diff" to check for the difference.

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

Code:
echo \\0007

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run Bash Script thrice & then interval for 10 mins.

Hi... I am very new to shell scripting. I have written a script with help of this forum and some googling and it works the way I want it to. Currently this script checks for my SIP trunk registration every 5 seconds, if registration is not available then it reboots my router through telnet... (4 Replies)
Discussion started by: jeetz
4 Replies

2. Shell Programming and Scripting

invoke this command after every 10 mins

Hi, I have an command which find the files modified within last 3 days and then after selecting the files from the location it make the tar format and send it to the specified destination ...now I want that this task to be automative ..that is it should happen after every 5 minutes ..plz guide me... (5 Replies)
Discussion started by: Neera
5 Replies

3. Shell Programming and Scripting

mail command | takes 10 mins.

I'm trying to send a e-mail through a shell script using the mail command. TO=your_mail@gmail.c,my_mail@gmail.com mail -s "This is a mail" $TO < Message.txt I receive mail only after 15-20mins but if i specify on 1 email id, I get the mail in seconds. Why is this happening? (0 Replies)
Discussion started by: rocker_me2002
0 Replies

4. Shell Programming and Scripting

How to run the particular command continously for 30 mins in perl?

Hi, I have command that should run continuously for 30 mins but not every day not once in a week , not one in a month. whenever i call that particular program that command should run for 30 mins and stop. #Contents of test.pl `ls -l *.txt`; #some other lines of code to print ... (1 Reply)
Discussion started by: vanitham
1 Replies

5. Shell Programming and Scripting

How to run a script automatically

Hi All, How can i run a script every week automatically. Thanks & regards, Sam (5 Replies)
Discussion started by: sam25
5 Replies

6. Shell Programming and Scripting

How to schedule a cronjob to run every 15 mins ?

Hi, I want to schedule a job to run every 15 mins through cron. searched the forums and came up with this piece of code.i have given this in my crontab 0-59/15 * * * * sh /usr/ss/job But its not being run. Have i made any mistake here. Can any1 post the cron code for scheduling the... (5 Replies)
Discussion started by: suresh_kb211
5 Replies

7. UNIX for Dummies Questions & Answers

command to run a command after 30 mins

how to schedule a command to run after 30 mins ? (3 Replies)
Discussion started by: gridview
3 Replies

8. UNIX for Dummies Questions & Answers

how to run a Script automatically

How to make a script run automatically using a cron?? i do not know abt cron...... if i have simple.sh file and i need this to run everyday at a particular time what needs to be done thanks in advance (4 Replies)
Discussion started by: hamsa
4 Replies

9. UNIX for Dummies Questions & Answers

How to run three scripts one after another automatically???

Hi !! How do u run three scripts one after another automatically using crontab command at some specified regular interval. Say i have three scripts A,B,C and i want to run the three scripts A followed by B followed by C. REQUIRE HELP URGENTLY Thanks in advance Arunava . (3 Replies)
Discussion started by: arunava_maity
3 Replies

10. UNIX for Dummies Questions & Answers

How to run a script automatically ?????

Hi All, How to run a script automatically using cronjob everyday from Monday to Friday 9A.M to 5P.M at an interval of ONE HOUR.I want the complete syntax means how to put in the cron job and there after. URGENTLY NEED HELP THANKS IN ADVANCE CHEERS Arunava (7 Replies)
Discussion started by: arunava_maity
7 Replies
Login or Register to Ask a Question