• Status: Solved
• Priority: Medium
• Security: Public
• Views: 513

# Cron Job every minute during Game Time

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?

-Dan
0
dsg138
1 Solution

Commented:
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

Commented:
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 Commented:
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

Commented:
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

Commented:
* 11-23,0-2 * * 4-6,0-1
0

Author Commented:
This one worked for me!
Thanks everyone for the help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.