Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

make unix sleep?

Posted on 2003-11-20
4
Medium Priority
?
667 Views
Last Modified: 2013-12-26
here's the thing.  i'm running hp unix ksh shell.  i have a shell script that i want to execute every 5 minutes starting at 2am and ending at 5 am. the shell script will log into a database running on the same server, check a table for the presence of a flag, and depending on the flag, do something or do nothing. my question is, is there a way to make unix run a shell scipt every 5 minutes without making a ton of entries in a cronfile and using crontab? please help!
0
Comment
Question by:benpung
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9789246
use sleep 300
it will make script to sleep for 5 minutes.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9789261
u can use a while loop
while :  # this will make your script to run forvere
do
 check something
 do something or nothing.
 sleep 300
done
0
 
LVL 9

Expert Comment

by:HamdyHassan
ID: 9790069
You still need crontab because "starting at 2am and ending at 5 am"

$ crontab -e
# My Script do that, and run Mon-Fri 2:00AM - 5:00AM - Every 5 min
0,5,10,15,20,25,30,35,40,45,50,55 2-5 * * 1-5 /home/script_path/script.ksh

0
 
LVL 9

Accepted Solution

by:
HamdyHassan earned 200 total points
ID: 9790075
sorry , last run will be 4:55AM
0,5,10,15,20,25,30,35,40,45,50,55 2-4 * * 1-5 /home/script_path/script.ksh
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question