15,891,431 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Mattintosh (Top 1 by date)
Mattintosh
25-Jun-13 16:27pm
View
Spot on. I have written stuff that works exactly this way in the past, and I highly recommend it for unattended batch processing, with a couple of things to be aware of first.
1) Scheduled Tasks (in more recent versions of Windows, it's called Task Manager, and it's under Administrative Tools) will not run more often than every 5 minutes. You set it up to trigger the actions daily at a set time, repeating every 5 minutes thereafter. From what I can tell, you cannot run your task trigger more often than this. If you need to run it with more than a 5 minute granularity, you'll have to use a Windows Service and a threading timer.
2) Building a new command line app for every task you want to trigger is a difficult-to-maintain mess. So you're going to have some overhead with a general-purpose task engine. The ones I've written are specific enough to require an input, archive, and error directory path (or hostname, paths, and credentials for FTP) for each sub-task. The engine checks the database to see which sub-tasks need to run right now, and it kicks them off. The sub-tasks themselves are smart enough to go get their files from the input location and process them, then move them to the archive or error locations (pass/fail style, and we keep a complete history).
So there's a table in the database that tells it when to run, where to get data, where to put data, and what classname to instantiate to process the data. There's a command-line app that gets that config for the currently needed processes, instantiates each active process' class, and runs it. And there's a timer that kicks off the command-line app every 5 minutes.
It works well and it's dirt simple. Let the OS handle the timing stuff. Don't invent your own if you don't have to.