Questions tagged [scheduled-tasks]

A scheduled task is a computer task that is scheduled to happen at a certain time and may repeat.

Scheduled tasks are used for automation so that human presence in not required in order to execute the required task at the required time. Tasks may be scheduled to run once, or repeatedly at a specific time of a specific date.

Tasks may also be scheduled to run when specific preconditions are met. This is usually achieved by running a second scheduled task that runs sufficiently frequently, checking for preconditions, executing the desired program when these preconditions are met.

Tasks may be scheduled:

  • On *NIX: using cron. See
  • On Windows: using Windows Scheduled tasks

Lots of task automation software exists, including

7207 questions
99
votes
19 answers

How to call a method daily, at specific time, in C#?

I've searched on SO and found answers about Quartz.net. But it seems to be too big for my project. I want an equivalent solution, but simpler and (at best) in-code (no external library required). How can I call a method daily, at a specific time? I…
Delta76
  • 13,931
  • 30
  • 95
  • 128
93
votes
12 answers

My C# application is returning 0xE0434352 to Windows Task Scheduler but it is not crashing

I have written a few C# apps that I have running via windows task scheduler. They are running successfully (as I can see from the log files that they are writing ) but windows task scheduler shows them returning a last run result of 0xE0434352. Is…
Kynrek
  • 1,319
  • 1
  • 10
  • 9
88
votes
10 answers

How might I schedule a C# Windows Service to perform a task daily?

I have a service written in C# (.NET 1.1) and want it to perform some cleanup actions at midnight every night. I have to keep all code contained within the service, so what's the easiest way to accomplish this? Use of Thread.Sleep() and checking for…
ctrlalt3nd
  • 1,352
  • 3
  • 13
  • 18
84
votes
10 answers

Task Scheduler failed to start. Additional Data: Error Value: 2147943726

I am using windows 10 task scheduler to run tasks that require me using my personal user account (its necessary to use my user and not system user because of permission issues - I am part of an organization). In windows 7 computers everything worked…
misha312
  • 1,443
  • 4
  • 18
  • 27
84
votes
6 answers

Windows task scheduler error 101 launch failure code 2147943785

I'm trying to schedule my C# program to run on Windows scheduler. I'm using, Windows 7 Professional. I can create the task security options set to run whether or not the user is logged in, gave it high privileges, it is to launch an exe on a remote…
user1966843
  • 849
  • 1
  • 6
  • 3
82
votes
5 answers

Could not load file or assembly Operation is not supported. (Exception from HRESULT: 0x80131515)

When I run CodedUI Test from a small Console tool via vstest.console.exe from a scheduled task I sometimes see this error message on different PCs: error : Could not load file or assembly 'file:///C:\foobar.dll' or one of its dependencies.…
magicandre1981
  • 27,895
  • 5
  • 86
  • 127
78
votes
3 answers

Will a SQL Server Job skip a scheduled run if it is already running?

If you schedule a SQL Server job to run every X number of minutes, and it does not finish the previous call before the # of minutes is up, will it skip the run since it is already running, or will it run two instances of the job doing the same…
Sam Schutte
  • 6,666
  • 6
  • 44
  • 54
77
votes
3 answers

How to prevent airflow from backfilling dag runs?

Say you have an airflow DAG that doesn't make sense to backfill, meaning that, after it's run once, running it subsequent times quickly would be completely pointless. For example, if you're loading data from some source that is only updated hourly…
m0meni
  • 16,006
  • 16
  • 82
  • 141
76
votes
9 answers

What's the difference between fixed rate and fixed delay in Spring Scheduled annotation?

I am implementing scheduled tasks using Spring, and I see there are two types of config options for time that schedule work again from the last call. What is the difference between these two types? @Scheduled(fixedDelay = 5000) public void…
Adam
  • 1,041
  • 1
  • 7
  • 22
69
votes
7 answers

How to stop a Runnable scheduled for repeated execution after a certain number of executions

Situation I have a Runnable. I have a class that schedules this Runnable for execution using a ScheduledExecutorService with scheduleWithFixedDelay. Goal I want to alter this class to schedule the Runnable for fixed delay execution either…
Spycho
  • 7,698
  • 3
  • 34
  • 55
69
votes
16 answers

Windows Scheduled task succeeds but returns result 0x1

I have a scheduled task on a Windows 2008 R2 server. The task includes a Start In directory entry. The task runs, and the batch file it runs does what it is supposed to do. When I run the batch file from a command prompt, I see no errors. The…
user241099
  • 818
  • 2
  • 7
  • 7
69
votes
9 answers

Issue with Task Scheduler launching a task

I have a task scheduled in my Windows 2008 R2 machine but it failed to trigger with the following error in the log (Event logs). Error: Task Scheduler failed to start "\Hyatt_International_Distribution" task for user "SAFFRON3\cb_admin". Additional…
Kausty
  • 899
  • 2
  • 10
  • 22
64
votes
6 answers

How can I schedule a daily backup with SQL Server Express?

I'm running a small web application with SQL server express (2005) as backend. I can create a backup with a SQL script, however, I'd like to schedule this on a daily basis. As extra option (should-have) I'd like to keep only the last X backups (for…
edosoft
  • 17,121
  • 25
  • 77
  • 111
64
votes
1 answer

How to restart a windows service using Task Scheduler

The easiest way to do this is to create a batch file with: NET stop NET start Once the batch file is created and tested, add it to Windows Task Scheduler and run it at a specific time interval. Problem here is, when…
Kurt Van den Branden
  • 11,995
  • 10
  • 76
  • 85
64
votes
3 answers

Spring Scheduler stops unexpectedly

We have a Spring 3 web application on Tomcat 6 that uses several scheduled services via @Scheduled (mainly for jobs that run every night). Now it appears that sometimes (rarely, perhaps once in two months or so) the scheduler thread stops working,…
obecker
  • 2,132
  • 1
  • 19
  • 23