Mantis - Resin
Viewing Issue Advanced Details
3680 minor always 09-09-09 18:00 09-10-09 09:57
emil  
ferg  
normal  
closed 3.1.9  
fixed  
none    
none 3.1.9  
0003680: scheduled tasks not working for sundays
(rep by jurius)

My inquiry is about the <resin:ScheduledTask> configuration problem.

We have a requirement in our application to schedule some task to run every week Sunday mornings from 1:10 AM to 1:40 AM.

The solution looks simple enough - to configure 2 scheduled tasks (to stop the process and respectively to restart it) in resin-web.xml, Resin deployment descriptor file.

Resin documentation has a very nice outline of how to configure the schduled task. In this particular case the CRON-style pattern description fits well.

Here is cron trigger syntax from online documentation http://www.caucho.com/resin/admin/scheduling.xtp [^] :

cron fields

# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)
# | | | | |
* * * * *

Hence how the schduled tasks are written in the resin-web.xml file:

=========
<scheduled-task class="taskScheduler.StopValidation>
<cron>10 1 * 1-12 0</cron>
</scheduled-task>

<scheduled-task class="taskScheduler.RestartValidation">
<cron>40 1 * 1-12 0</cron>
</scheduled-task>
=========

10 1 * 1-12 0 means: "run every Sunday of any month at 1:10 AM". It is equivalent (according to the above pattern) to 10 1 * * 0, but I found from experience that 10 1 * 1-12 0 works much better.

The problem is that this configuration doesn't work for 0 or 7 (both for Sunday, as per the above pattern), but perfectly works for 1 to 6 (Monday - Saturday).

I've been thinking on different ways around, shifting server clock one day ahead (so Sunday morning becomes Monday morinng for the server!) one of them.

We are using Resin Pro 3.1.9.
I conducted many experiments before I decided to write to this forum. Maybe someone had similar situations and may have found some solution to this.

Thanks for your time and hopefully suggestions.

Notes
(0004231)
ferg   
09-10-09 09:57   
server/14a3