suspending cron job execution between certain period

suspending cron job execution between certain period

am 15.04.2008 15:10:35 von zmasood

Hi,

I have a scheduled cronjob that runs after every 15 minutes on 24 hrs
basis.

*/15 * * * * /opt/bea/healve/scripts/monitoring/run.sh

I want to suspend it between the hours of 2AM and 4:30AM.

One option is that I create another job to take the execution
permissions away from the run.sh script at 2AM and give it back at
4:30AM. Is there a neater way of doing it?

Pls help

Thanks

Re: suspending cron job execution between certain period

am 15.04.2008 15:42:45 von PK

On Tuesday 15 April 2008 15:10, Zinger wrote:

> I have a scheduled cronjob that runs after every 15 minutes on 24 hrs
> basis.
>
> */15 * * * * /opt/bea/healve/scripts/monitoring/run.sh
>
> I want to suspend it between the hours of 2AM and 4:30AM.
>
> One option is that I create another job to take the execution
> permissions away from the run.sh script at 2AM and give it back at
> 4:30AM. Is there a neater way of doing it?

Can't you do something like this in the script:

....
h=`date +%H%M`
if [ $h -gt 200 ] && [ $h -lt 430 ]; then exit; fi
....go on as usual...

or, with bash:

if [[ "$h" > "0200" ]] && [[ "$h" < "0430" ]]; then exit; fi

Re: suspending cron job execution between certain period

am 15.04.2008 16:15:00 von Bill Marcum

On 2008-04-15, Zinger wrote:
>
>
> Hi,
>
> I have a scheduled cronjob that runs after every 15 minutes on 24 hrs
> basis.
>
> */15 * * * * /opt/bea/healve/scripts/monitoring/run.sh
>
> I want to suspend it between the hours of 2AM and 4:30AM.
>
> One option is that I create another job to take the execution
> permissions away from the run.sh script at 2AM and give it back at
> 4:30AM. Is there a neater way of doing it?
>
*/15 0-1,5-23 * * * /opt/bea/healve/scripts/monitoring/run.sh
30,45 4 * * * /opt/bea/healve/scripts/monitoring/run.sh