The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
automatically answer a question raised by a command pbsrinivas Shell Programming and Scripting 6 05-11-2008 03:43 AM
How to automatically detect command failure ashok2008 UNIX and Linux Applications 2 04-24-2008 02:27 PM
command to run a command after 30 mins gridview UNIX for Dummies Questions & Answers 3 05-14-2007 02:22 PM
files created within last 10 mins frustrated1 UNIX for Dummies Questions & Answers 5 08-03-2005 10:09 AM
Automatically executing a command robbiegregg UNIX for Dummies Questions & Answers 8 04-06-2005 11:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-01-2007
vikas027 vikas027 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 77
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 (permalink)  
Old 11-01-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,420
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 (permalink)  
Old 11-01-2007
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
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 08:27 AM.. Reason: added note about cron
  #4 (permalink)  
Old 11-01-2007
vikas027 vikas027 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 77
Unhappy

Quote:
Originally Posted by Yogesh Sawant View Post
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 (permalink)  
Old 11-01-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Capture the outputs and use "diff" to check for the difference.

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

Code:
echo \\0007
Closed Thread

Bookmarks

Tags
date, watch

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:06 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0