Force JasperReports Server scheduler (quartz) to recalculate next run time - quartz-scheduler

To get a bunch of new reports to run I changed the system date on my JasperReports Server. After I changed it back, the normally-scheduled reports did not run because the "next run time" is evidently calculated statically based on the previous run.
How can I force the quartz scheduler to recalculate the next run time?

This is what I ended up doing: for each scheduled report, edit the scheduled report and change the execution time by some small amount (say a minute). Then, click Next Next Next until you are done editing. This apparently forces the scheduler to recalculate; however, it is horribly time-consuming! If you do not change the execution time it will not recalculate the next run time.
Good luck.

Related

Stop 2 Conflicting Scripts Running At The Same Time

I have two scripts that do the same thing but for different companies, and during the process they both use the same tables.
It's imperative that only one script runs at once, as sometimes the timings vary greatly, and they are scheduled rather close together purposely. My question is, what is the best method to ensure these scripts do not run together? I tried to have a global field, set to 1 at the beginning of the script, and 0 at the end, so when the 2nd script runs, if global field = 1 - exit script -
This did not work, as both these scripts are scheduled server side, and I have read that the GLOBAL variable is local in this instance.
I assume, we are talking about FileMaker Server schedules.
Global variable will be reset every time you run a scheduled script. Every script will run on it's own session. You can not use them to ensure the scripts do not clash.
As far as I know, FileMaker Server does not run two schedules at the same time. The second script will be delayed until the first one finishes.
FileMaker Server can run simultaneous schedules if they are script schedules, thus an overlap can occur.
What you need to do is set a field that is not a global, so that the schedules can check against the value of that field.
A single record table would be ideal for this.
Make sure that you commit after setting the field, or you may get record locking issues.
Create an OS-level script that uses the fmsadmin command line to run one script, then run the second.
Set the FM Server schedule to run the OS script (which then runs the PSoS scripts).

ScheduledExecutorService: modify one or more running tasks

I have a program, it loads a few tasks from a file prepared by user and start executing them according the scheduling shown in the file.
Example: taskFile.txt
Task1: run every hour
Task2: run every 2 seconds
...
TaskN: run every monday at 10:00
This first part is Ok, i solved by using ScheduledExecutorService and i am very satisfied. The tasks are load and run as they should.
Now, let's image that the user, by GUI (at runtime), decides that Task2 should run every minute, and he wants to remove Task3.
I cannot find any way to access one specific task in the pool, in order to remove/modify it.
So I cannot update tasks at runtime. When user changes a task, I can only modify the taskFile.txt and restart the application, in order to reload all tasks according the newly updated taskFile.txt.
Do you know any way to access a single task in order to modify/delete it?
Or even, a way to remove one given task, so i can insert a new one in the pool, with the modifications wanted by the user.
Thanks
This is not elegant, but works.
Let's suppose you need 10 threads, and sometimes you need to manage a specific thread.
Instead to have a pool with 10 thread, use 10 pools with one thread for each, keep them in your favourite data structure, and act on the pool_1 when you want to modify thread_1.
It's possible to remove the older Runnable from the pool and put a new one with the needed changes.
Otherways, anything put in the pool became anonymous and will be not directly manageable.
If somebody has a better solution...

How to refresh field calculation in live time

I've created a function to calculate time difference between current time and time recorded as StartTime. All calculations are perfect but my "StopWatch" won't update every second. Is there a way of updating it, so it can display every second elapsed since start point?
Window refreshing script isn't an option really.
Short answer: no.
There is nothing in Filemaker that will happen as a result of merely time passing - except for a script paused for a duration or installed on a timer.
To show a live, ticking clock, your best option would be to use a web viewer - see an example file here: http://fmforums.com/forums/topic/71934-calculating-elapsed-time-realtime/?do=findComment&comment=340205

Issue with Sitecore scheduled task - last run time updates even though the task hasn't run ?

I have a scheduled task set up in the sitecore content editor that is set to run ever 5 minutes.
20100901T235900|20200101T235900|127|00:05:00
The frequency I have set up in the web.config is check every minute.
<frequency>00:01:00</frequency>
<agent type="Sitecore.Tasks.DatabaseAgent" method="Run" interval="00:01:00">
<param desc="database">master</param>
<param desc="schedule root">/sitecore/system/tasks/schedules</param>
<LogActivity>true</LogActivity>
</agent>
The problem seems to be that the last run time keeps updating every 5 minutes regardless of whether or not sitecore has checked to see if its due or not. So the time keeps updating and then sitecore checks to see if its due and alway says "not due" and never runs.
I have confirmed that the Sitecore server and DB server system times are in sync.
Does anyone know why the last run time would update even though sitecore has not run the task?
As a troubleshooting note. If I watch the logs and note i.e. that the last time it checked to see if it was due was 12:00:15. Then I go into the content editor and change the last run time to "an hour ago" or "a day ago" and wait until just before 12:05:15 to save the change. Then the task scheduler has not had time to update the last run time and sitecore picks up the task and runs it. I can see it in the logs. It will then run about 4 or 5 more times on the 5 minute mark but then reverts back to the same issue. I have to think it is because eventually sitecore no longer checks on the 15 second mark and there ends up being too big of a time interval between the two.
Any help would be greatly appreciated. Thanks.
Do you have more than 1 instance of web application connecting to the same database?
E.g. more than 1 developer using same database. Maybe some of the tasks are executed on another machine not on yours?
This is the most common scenario in which such a problem happens. Remember that Sitecore stores information about tasks execution in database and if you have multiple web applications using the same database, only one of them (and random each time) will execute tasks.

Windows Task Scheduler - Run only during window of time

I have a task already set up in the Windows Scheduler (on Win Server 2008). It works great but it can put a burden on the system during peak hours (when the box is being used for other things). I currently run the job every 15 minutes. Can Task Sch. be setup to run every 15 minutes but only during a certain window of time. So I could set it up to run every 15 min, but only from 5pm to 5am -- and not run at all from 5am to 5pm?
Set a daily schedule starting at 5pm. In the Advanced dialog, click Repeat task, then specify Every=15 minutes, Until:Time=5am.
Edit: The above instructions are for Windows 2003 Server or XP. If Windows Server 2008 is like Windows 7, then you can do the same thing through the Triggers tab. Set a daily trigger, Start=5pm, Repeat Task Every=15 minutes, For a duration of=12 hours.
You don't need to stick with the pre-defined times - you can type into these fields any value you wish.
For Windows 2008 & above this is what I did:
Create task
Triggers tab
New ...
Use the following settings
In this particular example I want to run the task from 12:06 AM to 23:50 PM.
In "for a duration of" I entered the amount of minutes I want it to run for. Actually you could also enter some thing like 23:50:00 in the "for a duration of" field. It will automatically convert it to minutes after you click OK. That was my experience.
In the triggers tab you can add multiple triggers by using the "New" button. See screenshot below.
You have to set on the the Start field: 5:00:00 AM and on 'for duration of' you have to write '12 hours' or '12:00:00'