is there any way to excute script every N seconds?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting is there any way to excute script every N seconds?
# 1  
Old 01-20-2006
is there any way to excute script every N seconds?

Hello
i have script that show me stuff , i need to excute this script every N seconds , is there any way to do it with one liner ? ( mybe perl )
thanks
# 2  
Old 01-20-2006
Does "some command" every 5 seconds.

Code:
while true
do
sleep 5
some command
done


Last edited by dangral; 01-20-2006 at 01:45 PM.. Reason: formatting
# 3  
Old 01-22-2006
is there any thing like that with perl ?

to be one liner ?
# 4  
Old 01-22-2006
You should not be creating an external wrapper to run a script every 5 seconds. The script itself should have an internal loop added.
# 5  
Old 01-23-2006
Try this :

Code:
yes 'date;sleep 5' | ksh

# 6  
Old 01-23-2006
yes 'date;sleep 5' | ksh
Want to iunderstand this . What exactly is being done here

Thanks
Ashok
# 7  
Old 01-23-2006
The command 'date' is executed every 5 seconds ...

Code:
$ yes 'date;sleep 5' | ksh
Mon Jan 23 16:31:56 NFT 2006
Mon Jan 23 16:32:01 NFT 2006
Mon Jan 23 16:32:06 NFT 2006
Mon Jan 23 16:32:11 NFT 2006
^C$


The yes command as piped input to another command that requires an affirmative response before it completes the specified action.

The yes command outputs 'date;sleep 5'.
Ksh read end execute yes output.
Ye outputs 'date;sleep 5' again .....


Jean-Pierre.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

./ignite.sh script fails after 5 seconds

Hello, I am trying to run a make_net_recovery Ignite for a server in a 2 node cluster . But I do get some issues. VG "/dev/vg59" is not defined in file "/etc/lvmtab". VG "/dev/vg59" is not defined in file "/etc/lvmtab_p". save_config: Error - vg00 not in the volume/disk group ERROR: ... (0 Replies)
Discussion started by: velde_van_der_a
0 Replies

2. Shell Programming and Scripting

Script variable help, Varying number of arguments to excute script

Hi Guy's. Hopefully someone can help me with what I am trying to archieve. So situation currently is, I have a script already setup however I have another script that sits infront of it. The main script basically goes and searchs multiple platforms for a list of entered data. In... (10 Replies)
Discussion started by: mutley2202
10 Replies

3. Shell Programming and Scripting

Login, excute command, logout Script Help

Good Evening all, After spending the last week or so reading many posts I decided to register and join in. This is my first post on the forum so please forgive me as im new to this, Im after some help in throwing together a quick basic script without using expect to change the password on several... (4 Replies)
Discussion started by: mutley2202
4 Replies

4. Shell Programming and Scripting

execute the shell script per ten seconds

hi, everyone. My want to execute the shell script below per 10 seconds PID=`pgrep java` if then /home/java/java fi crontab wouldn't help me. some one can give me suggestions?thanks ---------- Post updated at 07:29 AM ---------- Previous update was at 07:26 AM ---------- ... (6 Replies)
Discussion started by: AKB48
6 Replies

5. Shell Programming and Scripting

Script to display a dialog box every 5 seconds

I want to create a script that displays a dialog box every interval of time and exits that loop when a user presses ENTER Any idies? (4 Replies)
Discussion started by: amitlib
4 Replies

6. Shell Programming and Scripting

Script to add time convert to seconds

Hi, What i am looking for and i am new to this too, is a bash script that will add time in the format hh:mm:ss and produce the answer in minutes or seconds. It needs to be a loop since there are hundreds of times in my file. This is data is from a CDR that calculates duration of time used. ... (2 Replies)
Discussion started by: trotella
2 Replies

7. Shell Programming and Scripting

Exit script if the user dosent enter any data within 5 seconds

Hello friends, Kindly help me in developing a script that asks user to enter a value and will wait for 5 seconds for the feedback. If there is no answer from the user the script will perform exit or it will continue doing something else Ex: If yu have a multi OS system i believe while... (3 Replies)
Discussion started by: frozensmilz
3 Replies

8. Shell Programming and Scripting

remove directory x seconds after script completes

Hi guys, I am working with a script within a Mac OS X package installer. The package installer will run the bash script once the files have been copied/installed. I have a little trouble with the last line of my script causing the package installer to crash once in a while and I have narrowed it... (1 Reply)
Discussion started by: tret
1 Replies

9. Shell Programming and Scripting

Help with script, trying to get tcpdump and rotate the file every 300 seconds

Greetings, I just started using scripting languages, im trying to get a tcpdump in a file, change the file name every 5mins ... this is what i have but its not working ... any suggestions? #!/bin/bash # timeout.sh #timestamp format TIMESTAMP=`date -u "+%Y%m%dT%H%M%S"` #tdump =`tcpdump... (3 Replies)
Discussion started by: livewire
3 Replies

10. Shell Programming and Scripting

wait for 5 seconds in shell script

hi how can i wait for 5 seconds inside my shell script? 'wait 5' command doesnot seem to be working? (2 Replies)
Discussion started by: gopsman
2 Replies
Login or Register to Ask a Question