benpung
asked on
make unix sleep?
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!
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
while : # this will make your script to run forvere
do
check something
do something or nothing.
sleep 300
done
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,4 5,50,55 2-5 * * 1-5 /home/script_path/script.k sh
$ 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,4
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
it will make script to sleep for 5 minutes.