how to loop script for every 1 hour

Hi All,

Need to run a1.sh script using nohup command (since crontab facility not there in my unix server) as below:
nohup ksh -x a1.sh &

a1.sh contains:
nohup ksh -x b1.sh 2> b1.log &

In a1.sh script i need to trigger b1.sh script every one hour. How to loop b1.sh to run for every 1 hour?

Thanks in Advance,

How long the b1.sh script runs?

You can use sleep command in side a1.sh for a predefined time and then can fire b1.sh from it.

but the problem is b1.sh script takes around 35mins to run.
i need to run b1.sh for every 1 hour. Is there a way to loop around without sleep command using date command?

Thanks in Advance,

How about this?

 
cat a1.sh
 
while true 
do
if [ -f /tmp/verify ] ; then
exit
fi
sleep 3600
nohup ksh -x b1.sh 2> b1.log &
done
 
run nohup a1.sh &

When you want to come out of script create a file /tmp/verify

I'm not sure on how you want to use date here!

@HemaV: are you able to use the at command?