Windows Task Scheduler - Run only during window of time - scheduled-tasks

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'

Related

UiPath Orchestrator Triggers - Cron Expression For specific day of month or next working day if not a working day

I've currently got this Cron expression that I'm using to trigger a process in UiPath Orchestrator:
0 0 15 21W * ? *
Runs on the closest working day to the 21st of each month at 3pm.
However I need it to run on the next working day at 3pm if the 21st is a non working day.
Tried searching for an answer and nothing quite fit the brief.
I used this website to build my expression (which is a great tool) but it only had an option for 'nearest day' and not next working day given a specific day of month: https://www.freeformatter.com/cron-expression-generator-quartz.html
As you don't need the nearest day, you can't use the functionality of Orchestrator cronjob. I would recommend creating a wrapper process as follows:
Create a new process, let's call it StartJobByCheckingDate
Now create a trigger that starts StartJobByCheckingDate each day at 3pm
So that process is now your manager of your desired process
Now we need to check if it is the 21th day
Here you have different ways to solve it
You could create a DataTable or even a file in the StartJobByCheckingDate process, that contains all the different days where your desired process should be fired (but this is very manual, you might not want to update this every year, so this might not be the smartest but the easiest solution)
The other idea is to check if the current day is the 21th day. If so check if it is Saturday/Sunday (non-working day).
If true: you could now create a empty dummy file somewhere that tracks that the 21th was a non-working day, and the next day you check that file existing, if it exists you check the current day to be a working day, and if so you delete the file again and start your desired process
If false: just start your desired process directly
I think 2. idea would be that best. Sure you have 365 jobs runs/year. But when you keep that helper process smart this will just be seconds.
Another idea instead of using the dummy file, would be to use Entities. Smarter but need some more time to get familiar with.
We have (had) the exact same issue. Since UiPath doesn't offer a feasible solution out of the box, we will work around the restriction using the following strategy: We trigger the actual job daily, considering a custom-built, static NonWorkingDay-list that will just suppress the execution of the robot every day we don't want it to run.
These steps are needed:
Get a list with of all known bank holidays, saturdays and sundays until 2053 or so...
Build a the static exclusion-list using a script that does something like this (pseudocode. I will update the answer once we have actually implemented the solution):
1. get all valid execution dates
loop through every 28th of the month until end of 2053
if the date is in the bankHolidayList then
loop until the next bankDay is found
add it to the list of valid ExecutionDates
else
add the date to the validExecutionDate-list
2. build exclusion-list
loop through every day until end of 2053
if the date is not in the validExecutionDate-list
add it to the exclusionDate-list
Format the csv accordingly and upload it to the orchestrator tenant as a NonWorkingDay-List
Update your trigger to run daily at your desired time, using the uploaded NonWorkDay-Calendar
While the accepted answer will surely work as well, we prefered to go with this approach because having a separate robot that does nothing but executing a UiPath trigger just doesn't seem right to me. With this approach we have no additional code that we potentially need to maintain.
In my oppinion not having a solution for this concern out of the box is a lack of feature that UiPath will (hopefully) fix until end of 2053 ;-)
Cheers
You can configure your trigger to launch oftener, then manage dates at init of your process, but you must set up a list of "holydays" or check in some way.
Also you can use the calendar option of orchestrator (+info)

I need to create a powershell script to trigger a specific windows task daily on a specific interval of time for a particular duration

I need to create a powershell script to trigger a specific windows task daily on a specific interval of time for a particular duration.
My scenario is like this task needs to be trigger everyday on a half an hour interval from 5 am to 5 pm. I tried with the New-JobTrigger options, but I dont see an repetation option.
I am using powershell version 5.1
Try heading towards a scheduled task.
- Write your powershell script.
- Create a scheduled task that runs it whenever you want with a specified time range.

Quartz Scheduler job runs continuously after trigger

I am using a product called Mirth to reach out to an SFTP server and download a handful of files on a weekly basis. The product has a cron feature, where it allows you to use a cron expression to do configure this function.
The cron expression I am using:
0 45 13 ? * MON *
NOTE: This is not typical Linux-based cron. It's a cron expression spec used by Java for scheduling things even down to the second (https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm).
Is supposed to reach out at 1:45 PM every Monday and pull down files. But when it reaches out it does so continuously for 20 minutes or so, downloading the same files a few hundred times instead of just once.
Is there vagueness in this expression? It seems like it should only call once. I did just notice that there appears to be a space at the very beginning of the expression, not sure how that would make the thing run for 20 minutes again and again, though.
You could ease your crontab scheduling with crontab generators, like ie. this website:
www.crontab.guru
or
www.crontab-generator.org
(These are first two Google results)
From what you described, it looks like invalid syntax for crontab.
EDITED:
1:45 PM every Monday would be:
45 13 * * 1

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.

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

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.