Solved

Cron Job every minute during Game Time

Posted on 2010-09-09
6
502 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWS ELB 5 79
cannot rename datastore 3 48
linux - yum package installation issue 2 13
How to change the nameserver on Ubuntu Server 6 23
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
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…
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 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.:

809 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