PDA

View Full Version : ScheduledTask configuration problem


jurius
09-08-2009, 06:02 PM
Hi,

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.
- jurius

emil
09-10-2009, 01:01 AM
Hi jurius,

Thanks for the detailed report. I've filed this as a bug here:

http://bugs.caucho.com/view.php?id=3680

Take care,
Emil

jurius
09-11-2009, 03:49 AM
Hi Emil,

You are welcome and thanks for your quick response and effort.
I have checked the link to the bug tracking system, you provided with

http://bugs.caucho.com/view.php?id=3680

recently and it now shows the Status as "closed" and Resolution as "fixed".

Does this mean that Resin users (such as our company, netlojic.net) may check out the Resin build with this fix from Caucho.com web site or this fix will be reflected in some future build of Resin?

Thanks again,
- jurius

ferg
09-11-2009, 03:58 AM
That particular fix is already in 4.0.1, we just needed to add it to the 3.1.x tree. I'm not sure when the next 3.1.x release will be, but it'll be after 4.0.2 which is around the beginning of October.