Solved

make unix sleep?

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 133
sumDigits challenge 9 170
building a service to accessed via telnet client, want colors ? 4 92
Problem to event 3 102
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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