<p>What are the different approaches for creating scheduled tasks for web applications, with or without a separate web/desktop application?</p>

[{'answer_id': 23386, 'author': 'Eric Z Beard', 'author_id': 1219, 'author_profile': 'https://Stackoverflow.com/users/1219', 'pm_score': 2, 'selected': False, 'text': '<p>I think Stack Overflow itself is using an ApplicationCache expiration to run background code at intervals.</p>\n'}, {'answer_id': 23387, 'author': 'ceejayoz', 'author_id': 1902010, 'author_profile': 'https://Stackoverflow.com/users/1902010', 'pm_score': 2, 'selected': False, 'text': '<p>If you\'re on a Linux host, you\'ll almost certainly be using <a href="http://en.wikipedia.org/wiki/Cron" rel="nofollow noreferrer">cron</a>.</p>\n'}, {'answer_id': 23392, 'author': 'Marcel', 'author_id': 2554, 'author_profile': 'https://Stackoverflow.com/users/2554', 'pm_score': 1, 'selected': False, 'text': '<p>Under linux you can use cron jobs (<a href="http://www.unixgeeks.org/security/newbie/unix/cron-1.html" rel="nofollow noreferrer">http://www.unixgeeks.org/security/newbie/unix/cron-1.html</a>) to schedule tasks.</p>\n\n<p>Use URL fetchers like wget or curl to make HTTP GET requests.</p>\n\n<p>Secure your URLs with authentication so that no one can execute the tasks without knowing the user/password.</p>\n'}, {'answer_id': 23412, 'author': 'Nick', 'author_id': 1490, 'author_profile': 'https://Stackoverflow.com/users/1490', 'pm_score': 1, 'selected': False, 'text': "<p>I think Windows' built-in Task Scheduler is the suggested tool for this job.  That requires an outside application.</p>\n"}, {'answer_id': 23419, 'author': 'Jason Shoulders', 'author_id': 1953, 'author_profile': 'https://Stackoverflow.com/users/1953', 'pm_score': 1, 'selected': False, 'text': '<p>This may or may not be what you\'re looking for, but read this article, "<a href="http://www.codeproject.com/kb/aspnet/aspnetservice.aspx" rel="nofollow noreferrer">Simulate a Windows Service using ASP.NET to run scheduled jobs</a>". I think StackOverflow may use this method or it was at least talked about using it.</p>\n'}, {'answer_id': 23441, 'author': 'Ian Nelson', 'author_id': 2084, 'author_profile': 'https://Stackoverflow.com/users/2084', 'pm_score': 3, 'selected': True, 'text': "<p>If we're talking Microsoft platform, then I'd always develop a separate Windows Service to handle such batch tasks.</p>\n\n<p>You can always reference the same assemblies that are being used by your web application to avoid any nasty code duplication.</p>\n"}, {'answer_id': 23474, 'author': 'Daniel Auger', 'author_id': 1644, 'author_profile': 'https://Stackoverflow.com/users/1644', 'pm_score': 1, 'selected': False, 'text': "<p>A very simple method that we've used where I work is this:</p>\n\n<ol>\n<li>Set up a webservice/web method that executes the task. This webservice can be secured with username/pass if desired.  </li>\n<li>Create a console app that calls this web service. If desired, you can have the console app send parameters and/or get back some sort of metrics for output to the console or external logging. </li>\n<li>Schedule this executable in the task scheduler of choice.</li>\n</ol>\n\n<p>It's not pretty, but it is simple and reliable. Since the console app is essentially just a heartbeat to tell the app to go do its work, it does not need to share any libraries with the application. Another plus of this methodology is that it's fairly trivial to kick off manually when needed. </p>\n"}, {'answer_id': 23478, 'author': 'Seibar', 'author_id': 357, 'author_profile': 'https://Stackoverflow.com/users/357', 'pm_score': 2, 'selected': False, 'text': '<p>Jeff discussed this on the Stack Overflow blog -\n<a href="https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/">https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/</a></p>\n<p>Basically, Jeff proposed using the CacheItemRemovedCallback as a timer for calling certain tasks.</p>\n<p>I personally believe that automated tasks should be handled as a service, a Windows scheduled task, or a job in SQL Server.</p>\n<p>Under Linux, checkout cron.</p>\n'}, {'answer_id': 23479, 'author': 'Polsonby', 'author_id': 137, 'author_profile': 'https://Stackoverflow.com/users/137', 'pm_score': 1, 'selected': False, 'text': "<blockquote>\n  <blockquote>\n    <p>Use URL fetchers like wget or curl to make HTTP GET requests.</p>\n    \n    <p>Secure your URLs with authentication so that no one can execute the tasks without knowing the user/password.</p>\n  </blockquote>\n</blockquote>\n\n<p>You can also tell cron to run php scripts directly, for example. And you can set the permissions on the PHP file to prevent other people accessing them or better yet, don't have these utility scripts in a web accessible directory...</p>\n"}, {'answer_id': 66429, 'author': 'DustinB', 'author_id': 7888, 'author_profile': 'https://Stackoverflow.com/users/7888', 'pm_score': 1, 'selected': False, 'text': '<p>Java and Spring -- Use quartz.  Very nice and reliable -- <a href="http://static.springframework.org/spring/docs/1.2.x/reference/scheduling.html" rel="nofollow noreferrer">http://static.springframework.org/spring/docs/1.2.x/reference/scheduling.html</a></p>\n'}, {'answer_id': 7525665, 'author': 'Tim Cooper', 'author_id': 10592, 'author_profile': 'https://Stackoverflow.com/users/10592', 'pm_score': 0, 'selected': False, 'text': "<p>I think there are easier ways than using cron (Linux) or Task Scheduler (Windows).  You can build this into your web-app using:\n(a) quartz scheduler, </p>\n\n<p>or if you don't want to integrate another 3rd party library into your application:\n(b) create a thread on startup which uses the standard Java 'java.util.Timer' class to run your tasks.</p>\n"}, {'answer_id': 73130616, 'author': 'Chris Schuld', 'author_id': 249285, 'author_profile': 'https://Stackoverflow.com/users/249285', 'pm_score': 0, 'selected': False, 'text': '<p>I recently worked on a project that does exactly this (obviously it is an external service but I thought I would share).</p>\n<p><a href="https://anticipated.io/" rel="nofollow noreferrer">https://anticipated.io/</a></p>\n<p>You can receive a webhook or an SQS event at a specific scheduled time.  Dealing with these schedulers can be a pain so I thought I\'d share in such case someone is looking to offload their concerns.</p>\n'}]
['https://Stackoverflow.com/questions/23382', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2141/']