Solved

make unix sleep?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now