In the scheduled jon class, the task count should be declared static so it does not get reset each time the job is run.
If you want to save the job into database, call job.save() after it is set.
As for the the timing issue, I believe it is doing every number of minutes, or seconds starting from the time it starts.
Quinton McCombs wrote:
-----Original Message-----
From: Jeffery Painter [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 22, 2003 9:28 AM
To: Turbine Users List
Subject: odd scheduler behavior
my other question relates to TURBINE_SCHEDULED_JOBS... how can I switch my jobs back to being stored in the database? everytime I bring the server down I loose my scheduled tasks. I was reading somewhere about hard coding them into my TR.props but have not found a good resource on where to do this.
TR.props services.SchedulerService.classname=org.apache.turbine.service
s.schedule.TurbineSchedulerService
scheduler.enabled=true
Did you check the database table? Is your task still there?There does not appear to be a method for job.getId() even though all the howtos still show this method. I had to remove it to get the example working.
Try job.getJobId()my run method
public void run( JobEntry job ) throws Exception
{
Log.info("Scheduled job: " +
"task: " + job.getTask() +
" ran @: " + new Date(System.currentTimeMillis()).toString() +
" taskcount: " + taskcount
);
// update task counter
taskcount++;
}
I created a Services.vm to list all actively scheduled jobs.
I found it a bit difficult to display the variables but finally figured out the correct attributes for job, all except Oid (I can't get an id every way I could think of I tried)
#foreach ( $job in $jobs)
<tr>
<td> $job.Oid </td>
<td> $job.Second </td>
<td> $job.Minute </td>
<td> $job.Hour </td>
<td> $job.Weekday </td>
<td> $job.Day_of_month </td>
<td> $job.Task </td>
<td> $job.Email </td>
</tr>
#end
services.vm reads
$job.Oid 0 49 -1 -1 -1 PremiumTrackerNotice [EMAIL PROTECTED]
after adding my job.
turbine-system.log
[Tue Jan 21 21:37:05 EST 2003] -- INFO -- Scheduled job: task: PremiumTrackerNotice ran @: Tue Jan 21 21:37:05 EST 2003 taskcoun
t: 0
[Tue Jan 21 22:26:05 EST 2003] -- INFO -- Scheduled job: task: PremiumTrackerNotice ran @: Tue Jan 21 22:26:05 EST 2003 taskcoun
t: 0
Not sure what to tell you about the taskcount not being incremented. There have been many bugfixes and enhancements between 2.1 and 2.2. You might want to consider moving to 2.2 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
