Groups > Unix Linux > Linux discussions > Re: Cron syntax help...




Re: Cron syntax help...

Re: Cron syntax help...
Wed, 05 Mar 2008 08:54:57 GMT
On Tue, 04 Mar 2008 13:41:26 -0600, Ivan Marsh typed this message:

> On Tue, 04 Mar 2008 19:36:14 +0100, Walter Mautner wrote:
> 
>> Douglas O'Neal wrote:
>> 
>>> On 03/04/08 12:11, Ivan Marsh wrote:
>>>> Hey folks,
>>>> 
>>>> How do I set up a cron job to execute a script every fifteen
minutes
>>>> of the day except for between the hours of midnight and seven
AM?
>>>> 
>>>> thx-
>>>> 
>>>> 
>>> 15 7-23 * * * echo "run at 15 minutes past the hour,
8am-11pm"
>> 
>> Nay. That would go
>> 0,15,30,45 7-23 * * *
>> or shorter
>> */15 7-23 * * *
> 
> Okay... some clarification please.
> 
> Which of those runs every fifteen minutes, but doesn't run at all
> between midnight and seven AM?
> 
> I'm trying to set something up that should check status of a system
> every fifteen minutes during business hours and send an alarm if there's
> an issue. But, unlike me, the people that will respond to this alarm
> aren't available 24/7.

Man crontab

Post Reply
Re: Cron syntax help...
Wed, 05 Mar 2008 10:36:30 -060
On Wed, 05 Mar 2008 08:54:57 +0000, noi ance wrote:

> On Tue, 04 Mar 2008 13:41:26 -0600, Ivan Marsh typed this message:
>> On Tue, 04 Mar 2008 19:36:14 +0100, Walter Mautner wrote:
>>> Douglas O'Neal wrote:
>>>> On 03/04/08 12:11, Ivan Marsh wrote:
>>>>> Hey folks,
>>>>> 
>>>>> How do I set up a cron job to execute a script every
fifteen minutes
>>>>> of the day except for between the hours of midnight and
seven AM?
>>>>> 
>>>> 15 7-23 * * * echo "run at 15 minutes past the hour,
8am-11pm"
>>> 
>>> Nay. That would go
>>> 0,15,30,45 7-23 * * *
>>> or shorter
>>> */15 7-23 * * *
>> 
>> Okay... some clarification please.
>> 
>> Which of those runs every fifteen minutes, but doesn't run at all
>> between midnight and seven AM?
>> 
>> I'm trying to set something up that should check status of a system
>> every fifteen minutes during business hours and send an alarm if
>> there's an issue. But, unlike me, the people that will respond to this
>> alarm aren't available 24/7.
> 
> Man crontab

I wouldn't have asked the question if I didn't want confirmation that I
was doing it right.
 
> the */15, the first answer runs once 15 minutes after each hour.

That part I was pretty sure about... it was the excluding hours from the
range that I wasn't too clear on.

It seems to be working as expected now, considering the first alert this
morning came at 07:00:01... that's pretty funny.

I'm sure the programmers were very happy not to have their phones ringing
every fifteen minutes all night.

-- 
I told you this was going to happen.
Post Reply
about | contact