Solved

make unix sleep?

Posted on 2003-11-20
4
642 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 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET how to use the Vertical ScrollBar 5 119
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 1,255
Problem to open Excel file 15 213
JQuery serialize and unserialize 8 180
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

685 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