OT: cron help

Rick Stevens ricks at alldigital.com
Fri Dec 13 20:13:34 UTC 2013


On 12/12/2013 08:35 PM, g issued this missive:
>
>
> On 12/12/2013 09:10 PM, Bill Davidsen wrote:
>> Gregory Hosler wrote:
>>> On 12/13/2013 09:02 AM, T.C. Hollingsworth wrote:
>>>> On Thu, Dec 12, 2013 at 3:31 PM, Mike Wright
>>>> <mike.wright at mailinator.com> wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm trying to execute a command once a minute.  As a test I
>>>>> place this:
>>>>>
>>>>> 0,1 * * * * /bin/ping -c1 w.x.y.z > /dev/null 2>&1
>>>>>
>>>>> in /etc/cron.d/everyMinute
>>>>>
>>>>> but nothing is happening.  I've done "service crond restart".
>>>>>
>>>>> Any ideas?
>>>>
>>>> That "0,1" tells cron to run your command at N:00 and N:01 every
>>>> hour. You want "0-59" instead.
>>>
>>> or */1
>>>
>>> e.g.
>>>
>>> */1 * * * * /bin/ping -c1 w.x.y.z > /dev/null 2>&1
>>>
>>> All the best,
>>>
>> Don't think that does what you want, */5 is every 5th time, but /1 is
>> a NOP, I think. All asterisks should be once a minute.
>
>
>    * * * * *  command to execute
>    | | | | |
>    | | | | |
>    | | | | |
>    | | | | +--- day of week (0 - 7) 0 to 6 are Sunday to Saturday,
>    | | | |      or use names;  7 is Sunday, the same as 0
>    | | | +----- month (1 - 12)
>    | | +------- day of month (1 - 31)
>    | +--------- hour (0 - 23)
>    +----------- min (0 - 59)
>
> therefore;
>
>     1 * * * *
>
> should be use.

No. An asterisk in ANY field means "run for every unit this field
represents" and a "*/1" would be redundant (it may even be ignored).

A "*" in the first (minute) field means "run every minute". A "1" in
that field means "run on the first minute ONLY" (e.g. 12:01, 1:01, 2:01 
and so on, but NOT 12:02 or 1:02). A "0" in that field would run at 
12:00, 1:00, etc. Get it?
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks at alldigital.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-     Is that a buffer overflow or are you just happy to see me?     -
----------------------------------------------------------------------


More information about the users mailing list