Solved

Cron Job every minute during Game Time

Posted on 2010-09-09
6
500 Views
Last Modified: 2012-05-10
Experts,
I'm trying to run a cron job to update my scores page every minute (but only when Football Games are playing).  There won't be any score updates when the games are not being played.

The updates really need to happen during these times:
Thursday (7:00 PM EST - 1:00 AM EST) to account for late finishes
Friday (7:00 PM EST - 1:00 AM EST) to account for late finishes
Saturday (12:00 PM EST - 2:00 AM EST) to account for late finishes
Sunday (12:00 PM EST - 2:00 AM EST) to account for late finishes
Monday (7:00 PM EST - 1:00 AM EST) to account for late finishes

To make it simple I tried to every minute between 12PM and 1AM Thursday through Monday

*/1        11,12,13,14,15,16,17,18,19,20,21,22,23,0,1,2        *        *        4,5,6,0,1

It is not working correctly.

Ideally, I suppose 2 different ones could work.
1.  One on Thursday, Friday, Monday at:  7:00 PM EST - 1:00 AM EST
2.  the other on Saturday, Sunday at: 12:00 PM EST - 2:00 AM EST

Any ideas?

Thanks in advance,

-Dan
0
Comment
Question by:dsg138
6 Comments
 
LVL 12

Expert Comment

by:mccracky
ID: 33642290
cron only runs once every minute, the first column should just be * and not */1 and I'd probably put the days in numerical order.
0
 
LVL 2

Expert Comment

by:Orcen
ID: 33642386
Uhm, the 2nd field is the hour, not the days to run:

*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)
0
 

Author Comment

by:dsg138
ID: 33642436
Yes, the second field is the hour so I am trying to give it the hours in which it should run every minute.

1.  Every minute
2.  During the hours of 12PM - 1AM (11,12,13,14,15,16,17,18,19,20,21,22,23,0,1,2)  
3.  
4.  
5.  These days of the week: Thursday, Friday, Saturday, Sunday, Monday (4,5,6,0,1)

When the hours are listed that way, they are in order by time.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 2

Expert Comment

by:Orcen
ID: 33642467
You can try this:

*/1 11,12,13,14,15,16,17,18,19,20,21,22,23,0,1,2  *   *   4-1


Remember to check the cron's log to see if there are no other issues (such as permission issues, etc).
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 33644112
* 11-23,0-2 * * 4-6,0-1
0
 

Author Closing Comment

by:dsg138
ID: 33657174
This one worked for me!
Thanks everyone for the help!
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now