adding delay in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting adding delay in script
# 1  
Old 06-14-2008
adding delay in script

Hi Expert,
I need to run some command 5 times with 5 mins interval whenever one of the application on server hang.
Can I use below scripts ?
Thanks!

-------------
#!/bin/sh

command1
sleep 300
command2
sleep 300
command3
sleep 300
command4
sleep 300
command5
sleep 300
-----------------
# 2  
Old 06-14-2008
Quote:
Hi Expert,
not me Smilie

Code:
I need to run some command 5 times with 5 mins interval whenever one of the application on server hang.

When some application hangs without processing - how do you define the state of being 'hung' for an application ? is it not responding any queries or requests ?

You could use a while loop to achieve the same ( search the forum for while loop example )
# 3  
Old 06-14-2008
thanks.

Last edited by skully; 06-14-2008 at 04:03 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Loop without a delay

Hi, I am trying to understand what would happen if ther is a loop without any delay like sleep statement, I feel that would add a lot of load onto the CPU. Trying to understand how the load is reduced by the introduction of sleep(). Thanks and regards Zulfi (3 Replies)
Discussion started by: zulfi123786
3 Replies

2. Shell Programming and Scripting

Adding script

I have a script that will run a lint check on all shell and perl scripts that I have in 2 different branches and will report back in a tmp.log file that will show me what works and doesn't. I am trying to add to it, so that not only will it bring back the log file or errors, but also to improve... (2 Replies)
Discussion started by: bigbenn
2 Replies

3. Shell Programming and Scripting

Delay in running script from crontab

I am facing an issue where sometimes crontab is running script with some delay. Below is the stmt in script and it is the only stmt in script. echo "running at `date` " >> CRONCHECK.log Below is the cron entry. 0 11 * * * CRONCHECK.sh Below is the time of run each day. running at Fri... (8 Replies)
Discussion started by: Nishant Singh
8 Replies

4. Shell Programming and Scripting

How do I do a short delay (milliseconds) in a shell script?

I need to put a small delay into a shell script. I'm looking for something smaller than "sleep" - a second is way too long. I want to sleep something like 10 milliseconds. I've tried "usleep" and "nanosleep", but the script doesn't recognize them. I'm using the bash shell but I'm willing to... (9 Replies)
Discussion started by: harmlesscat
9 Replies

5. Shell Programming and Scripting

How to introduce delay in Shell Script till a key stroke.

Hi All, How to introduce delay in the Bash/Shell Script till key stroke. Below is the requirement.. 1.Execute set of commands. 2.Display the message echo "press any key to continue" Introduce a delay till key stroke. 3.Execute next set of commands. Thanks in Advance Sunil.K (5 Replies)
Discussion started by: sunilrk07
5 Replies

6. Shell Programming and Scripting

Want to have delay in multiple instances of the same shell script

Hello, My goal is to run the same Shell script in a parallel mode. This script will get triggered from different machines and different application teams by some job scheduling tool. They may trigger the process at the same time. so I want to have them in QUEUE ..and release them for execution on... (3 Replies)
Discussion started by: chetan_sonar
3 Replies

7. Shell Programming and Scripting

how to introduce delay in the script??(urgent)

Hi all, i would like to know how to introduce a delay in the execution of a cmd? am trying to copy a file which is about 650 mb and then perform some actions on it.. however since its huge i would like to introduce a delay in exection until the process is over i dont want it to proceed to... (10 Replies)
Discussion started by: wrapster
10 Replies

8. Programming

Delay a process.

How to delay a process. I need to to delay a process from 3sec. At that 3sec other back ground processes also should stop. (just sit 3sec for idle & then starts execution as normally) I use sleep(3)-But it not stop the bg processes I try to use loop but it not gurantee to wait 3sec. ... (2 Replies)
Discussion started by: ugp
2 Replies

9. UNIX for Dummies Questions & Answers

Delay in mv

Working on AIX 4.3 I have an active exe that accepts files for processing on our RS6000. Day to day i store these files in a secure place and at the end of the day I mv them one by one. After some reading and ofcourse trial and error i figured out that this helps... mv `ls -l |head -l | awk... (2 Replies)
Discussion started by: buRst
2 Replies

10. UNIX for Dummies Questions & Answers

Insert a delay in a script

Hi all, i need help. I want to write a script and insert a delay time of 10 seconds. Which is the command for do this? Thanks in advance (1 Reply)
Discussion started by: christian
1 Replies
Login or Register to Ask a Question