Shell Script Error

Hi Friend,

I wrote below script to run every saturday and suny with intervel of 4hrs, but it's not running in both days.
Kindly help on this....

#!/bin/ksh
INTERVAL=3600
INTERVAL1=14400
export INTERVAL
DAY=`date|cut -f1 -d ' '`
export DAY
COUNT=500
export COUNT

export CTR=0
while [ true ]
do
if [ ${CTR} -ge ${COUNT} ]
then
exit
fi
for DAY in Sat Sun
do
INTERVAL=$INTERVAL1
done
/home/mg01800/scripts/send_output.sh
CTR=$(expr ${CTR} + 1)
sleep ${INTERVAL}
done

you better cron those jobs on sat and sun like below

00 0,4,8,12,16,20 * * 6,7 /home/mg01800/scripts/send_output.sh

Thankyou...

I don't have permission to update crontab....

I agree it should be set as a cron job.

But I think the problem with your script is having "done" in the wrong place.

export CTR=0

while [ true ]
  do

    if [ ${CTR} -ge ${COUNT} ]
    then
      exit
    fi

    for DAY in Sat Sun
    do
      INTERVAL=$INTERVAL1
      /home/mg01800/scripts/send_output.sh
    done

    CTR=$(expr ${CTR} + 1)
    sleep ${INTERVAL}
              
 done

But I can't figure out why you set interval to 3600 at the beginning, and then overwrite it later on before you do anything with it.