Add the flag

#!/bin/bash
while :
do
./abc.sh PB
sleep 60
./abc.sh RA
sleep 60
./abc.sh GS
sleep 68400
done

Instead of making the script sleep for sometime, it doesn't work all the time as time may shift over a period.
How to make a script wake up every 30 seconds and check the current time, if the time is around 01:01:00 for the
./abc.sh PB then execute the script. When the check is done, how to mark it the flag as completed.
At 12:00AM reset all the flags and how to check again for the next day.

use cron

  1. edit the script to add:
. /etc/profile
. ~/.profile

This makes the environment in cron match what you have interactively.

use crontab -e and add this

1 1 * * * /home/me/myscript.sh 2&>1 > /home/me/myscript.log

Hi,

I do not want to use crontab

#!/bin/bash
while :
do
# Add wait until time is curdate 01:01:00
./abc.sh PB
#Wait until time is curdat 01:01:54
./abc.sh RA
#Wait until time is curdat 01:02:04
./abc.sh GS
#Wait until time is curdat 01:05:00
#Execute again from ./abc.sh PB checking the curtime,
done

---------- Post updated 06-20-10 at 08:09 AM ---------- Previous update was 06-19-10 at 11:11 PM ----------

#!/bin/bash
time=$(date +"%H:%M:%S")

while :
do
flag=0
until [ $time = '05:47:00' ]
do
echo "1st loop"
flag=1
done
until [ $time = '05:48:00' ]
do
echo "2nd loop"
done
done

How to add the conditional check for time at every step and if time is as mentioned and execute the script and move to nect step if the flag is 1.
At the end move to the first step and again wait until time is '05:47:00' and execute for the next day.

---------- Post updated at 08:43 AM ---------- Previous update was at 08:09 AM ----------

flag=0
time=$(date +"%H:%M:%S")
while :
do

while :
do
if [ $(date +"%H:%M:%S") = '06:30:00' ]
then
echo "1st loop"
fi
flag=1
done

while :
do
if [$flag = 1 ]
then
if [ $(date +"%H:%M:%S") = '06:31:00' ]
then
echo "2nd loop"
fi
fi

done
done

I have added the condition, while loop is added until it satisfies the first condition. There is repeated times on echo "1st loop" statement printed. So if the condition is true then, I have to exit that loop and go to next loop, so that only once the echo is printed.