Trigger a scheduled task upon completion of a different scheduled task - taskscheduler

I run a few weekly reports with python scripts and excel macros - each runs for a few hours, and must be done after midnight Monday morning. Task scheduler is the perfect tool for me! I'd like to get more efficient however. I would like to schedule these to start once the previous completes (instead of just guessing a time.) I see that I can begin the task 'On an event' and with a custom filter I can get really close to what I want... can one of you wizards help me out? I bet my right arm that I need to edit the XML code to be when task XYZ is = ### but I just don't know XML :(

This custom XML executes a task after the completion of FirstTask:
<QueryList>
<Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
<Select Path="Microsoft-Windows-TaskScheduler/Operational">*[EventData [#Name='TaskSuccessEvent'][Data[#Name='TaskName']='\FirstTask']]</Select>
</Query>
</QueryList>
Adapted from: http://blogs.msdn.com/b/davethompson/archive/2011/10/25/running-a-scheduled-task-after-another.aspx

The way I solved this was to have the actions in the order I wanted in my task scheduler. So the first was triggered by a time, and I had 4 actions after. Windows knows to do them in order.

Related

Schedule Tasks - Specific action on specific trigger

I want to start different actions depending on specific triggers.
For example, for trigger #1, action #1 should be started, for trigger #2, action #2 should be started.
Is this possible using Windows Schedule Task?
You can check this, opening a command window and asking information on the schtasks command. The explanation will give you a list of triggers you can use, like the following:
/SC schedule Specifies the schedule frequency.
Valid schedule types: MINUTE, HOURLY, DAILY, WEEKLY,
MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE, ONEVENT.
I believe ONEVENT is what you're looking for. The documentation and examples of schtasks /? are quite helpful.

Use gocron scheduler to schedule job on specific day at specific time

I want to schedule a job on a specific day at a specific time with some interval. I am using gocron scheduler for this. But I can't find a way to start a job on specific day. e.g. I want to execute a job on 7 Sept 2019 at 330pm. From 7 Sept, I want that job to be executed daily or weekly. How can I do that using gocron. or Any other packages available?
I tried passing UTC time to gocron.At() but its panics as it's expecting only "03:30" time formats and doesn't expect date.
When looking at the documentation for gocron, it does not seem to be designed to support scheduling things for specific days. It seems to be designed as a way to schedule things to run at various intervals, very similar to what the original cron utility was designed to do. So you would specify "I want this function to get called every 2 hours" or "I want this function to get called every Sunday at 3PM". There does not seem to be any documentation about starting jobs from a specific day.
The mentioned At(string) method is documented as allowing you to specify a time of day to run something. So you would use that to set that your job runs at 3:30PM.
If you wish to specify a start time, you would likely need to find another scheduling library or implement it yourself by creating a goroutine that sleeps until a specific time. The StackOverflow post mentioned by domcyrus looks like an excellent resource for implementing it yourself as well as listing some other scheduling libraries.

Parse Job Scheduling

I have a problem with the parse job scheduler. I have made a job that accepts some parameters and I want to run different instances of this job. Is there a way to do this? When I click on the Schedule a Job button it doesn't recognize a job that second time. It only lets me create the first job. And also in the new parse dashboard the schedule a job button is not even there.
As a free users you can only schedule one single job. If you want to schedule more than one job you must pay for it. Take a look here for more information.

Scheduling a task run

I have a script that must run at a certain hour for the amount of time I specify.
I'm looking at the clockwork gem (https://github.com/tomykaira/clockwork) which seems to be the closest piece of software I might eventually use to accomplish this, unfortunately it doesn't seem to give the ability to set a duration (start at 3PM stop 5PM), meaning I have to split the feature in 2, starting the script is going to be clockwork's job, stopping it is in the script itself with a custom solution.
Very suboptimal and messy.
How does people do this in Ruby? TIA
There is great gem called whenever for same job. With it you can set exact time for your task, like:
every 1.day, :at => '4:30 am' do
runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
end
But you'll have to have two stages, one for starting one for stopping your job, which seems to be more natural than job which kills itself at some time by my opinion.
Somewhat janky, but there is another solution. I'm not sure what you are using to host your app, but on Heroku you can set up a scheduler to run every 10 minutes, on the hour, or daily. Then inside the method that the scheduler calls, you can determine the current time. Say you only want to run it between 3pm and 5pm, you would just wrap your code inside an if statement that verifies the current time is between 3pm and 5pm (watch out for time conversions with UTC).
Hope this helps.

Windows Workflows - While Activity for creating multiple tasks not working

I am using a while activity for creating multiple tasks for a workflow. The code is executed fine and the task is created when the loop runs only once. But when the loop runs twice or more, only one task is getting created. Also the WF status shows as Error Occured.
All I want to do here is create multiple tasks (no of tasks depends on an entered column value) for the same user. Is it posible to use 'while' in this scenario? Or is there any other way to go ahead?
NB: I am using state machine workflow.
You may want to use a Replicator Activity which will in turn "clone" its child-activities. It can be run parallel or sequentially.
I found Working with the Replicator Activity and an Until Condition useful.
Otherwise without the Replicator, there is just one Task Activity.
In either case, make sure to assign a new Guid to the TaskId property. However, as an annoying "feature": it will not work if you just assign the TaskId property (I know, I tried and was like "Wth?!?"). Instead, bind the TaskId to a Field/Property and then assign to that.

Resources