Cron expressions (scheduled tasks)

Hi,
I’m really just not getting this whole cron expressions on the scheduled tasks. I was trying to setup a task to run on a specific date April 27, 2010. So this is what I had entered:

0 45 7 27 4 ? 2010

But it doesn’t create and I get the message in log “Based on configured schedule, the given trigger will never fire”.

So my question is why? What am I doing wrong? What am I missing? I’ve specified my hour, minutes, day of the month, the month, told to it to ignore day of the week (or at least I think I did) and the year. Any help would be appreciated guys.

Shane

It looks correct to me. I tied saving the exact same expression, and I did not get an error.

I tried the following expression, though, and I got the same error as you:

0 45 7 27 4 ? 2009

Perhaps the date/time on your server is ahead and it thinks 7:45 am, April 27, 2010 is in the past.

Thanks for the reply John. I had thought of that as well so I had our network admin check it out and it looks good.

I created a new one this morning, only I set the year 2011 and this time it created fine. I changed the year back to 2010 and set the day for tomorrow and it still worked fine, so this is very strange why it didn’t work the initial time but it seems to be fine now.

Shane

I scheduled a publishing task with this cron expression
0 40 13,14 ? * MON-FRI

The task fired first at 13:40 which is right. I expect the task to run a second time at 14:40, but it never got fired. Could you point where I missed?

Thanks, -Hua

Hua,
The expression looks fine to me, you could try 0 40 13,14 ? * 2-6

The job that fired at 13:40, did it complete before 14:40? If the 13:40 is still running then the 14:40 won’t start. Have you tried setting the 14:40 to a later time, maybe 15:40 (just to ensure there’s enough time between jobs)?

Shane