homepage Welcome to WebmasterWorld Guest from 23.20.149.27
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Crontab Syntax Help
Hours of the day
joshm




msg:3116900
 3:03 pm on Oct 11, 2006 (gmt 0)

Hi, I am wondering if this is possible... I want to run a cron job for the first 1-12 hours of the day every 5 minutes, but also for the 21st to 24th hour of the day. It may sound stupid but it makes sense with what i'm doing. Does the below crontab look right? I know */5 updates every 5 minutes but does the 1-12,21-24 part look correct?

*/5 1-12,21-24 * * *

 

jezra




msg:3117056
 4:50 pm on Oct 11, 2006 (gmt 0)

It looks good except for one small issue. Midnight, in a cron time is 0. So the 1-12,21-24 should be 1-12,21-0.

As a side note: does anyone know if 21-12 would work instead of 1-12,21-0?

joshm




msg:3117960
 9:26 am on Oct 12, 2006 (gmt 0)

Both 1-12,21-0 or 21-12 don't work. After trying to save it, it says "bad hour: errors in crontab file, can't install".

It looks like the only way is the long way:
*/5 1,2,3,4,5,6,7,8,9,10,11,12,21,22,23,0 * * *

Doing it the long way there's no errors.

mcavic




msg:3118332
 3:26 pm on Oct 12, 2006 (gmt 0)

What you want is:
*/5 0-12,21-23 * * *

That's the hour of midnight through the hour of noon, plus the hour of 9pm through the hour of 11pm, all inclusive.

joshm




msg:3119228
 2:54 am on Oct 13, 2006 (gmt 0)

The logic of */5 0-12,21-23 * * * looks right but I get the error message saying "bad hour: errors in crontab file, can't install".

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved