To stop execution in cron

hi guys
i have a question
my cron should start executing minute but it sould stop execute only i have tried tis

[CODE]10 * * * * /home/sample.sh >>
/data/band/cron_$(date+|%Y|m|d).log

You could count each execution and store it in a file. Use this execution counter to decide whether to proceed or not:

if [ -f "/tmp/exec_counter_$(date +%Y%m%d)" ]
then
        cnt=$( cat "/tmp/exec_counter_$(date +%Y%m%d)" )
        if [ $cnt -eq 10 ]
        then
                exit 1
        else
                (( cnt++ ))
                print "$cnt" > "/tmp/exec_counter_$(date +%Y%m%d)"
        fi
else
        print "1" > "/tmp/exec_counter_$(date +%Y%m%d)"
fi
1 Like

This may not be an adequate request for cron. Your entry will start at 10 min past each full hour and this will continue for ever and a day.
Try running a loop ten times and have a sleep 600 in there.

1 Like