[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Cron Job every minute during Game Time

Posted on 2010-09-09
6
Medium Priority
?
510 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

829 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