Here are the features you want:
- Support plug-ins, compile the tasks you want to perform into assemblies into the root directory of the framework, and then simply configure the line.
- Supports corn expressions. You want the task to execute when it is executed.
- Support for installation into Windows service (implemented via Topshelf)
- Ensure that the task is in the execution phase, even when the next trigger time is not repeated (if this is not done).
- And also... When I think of the ^o^, you can also focus on the project address: Https://github.com/leleroyn/Windows-TaskSchedule, put forward the features you want.
A brief introduction to the use of the project: writing plug-in support requires the implementation of the Ijob interface in the framework, with a simple example task built into the framework. Look directly at the code:
IJob
1: using System;
2: using System.Collections.Generic;
3: using system.linq;
4: using system.text;
5:
6: namespace windows.taskschedule
7: {
8: public interface IJob
9: {
Ten: void Init ();
One : void excute ();
: void OnError (Exception ex);
: }
: }
Demojob
1: using System;
2: using System.Collections.Generic;
3: using system.linq;
4: using system.text;
5:
6: namespace windows.taskschedule
7: {
8: public class Demojob:ijob
9: {
Ten: static log4net. ILog logger = log4net. Logmanager.getlogger (typeof(Demojob));
One : new DateTime ();
: public void Init ()
: {
: date = DateTime.Now;
: }
:
: public void excute ()
: {
: logger. Debug (date);
: }
£ º
: public void OnError (Exception ex)
: {
: logger. Debug (ex. ToString ());
: }
: }
: }
Configure the plug-in into the framework by modifying the Jobs.config file in the Configs directory so that the framework recognizes your task.
Jobs.config
1: <? XML version = "1.0" encoding = "Utf-8" ? >
2: <JobsserverName= "Demo-server" DisplayName= "Test Service"description= "Description of the test service">
3: <Jobname= "DemoJob1"type= " Windows.taskschedule.demojob,windows.taskschedule "cornexpress=" 0/3 * * * *? " />
4: </Jobs>
Parameter description:
ServerName: Service name when published as a service (preferably with no spaces)
DisplayName: Service display name when published as a service
Description: Service Description when published as a service
The job node is the specific configuration of the individual tasks, name: task names (preferably unique), type: Specific instances of plug-ins and assemblies, cornexpress: Time of task execution, support for corn expressions only
Perform tasks
If you are developing a debugging phase, you can start Windows.TaskSchedule.exe directly so that you can output relevant information directly from the console.
If you are deploying to a Windows service, you need to perform a Windows.TaskSchedule.exe install at the command line and then start: Windows.TaskSchedule.exe start
Uninstalling the Windows service is also straightforward, directly executing the Windows.TaskSchedule.exe uninstall to refer to the use of topshelf components. http://topshelf-project.com/
Want the source code, if you are careful in the beginning of the article should have, I would like to paste the address: https://github.com/leleroyn/Windows-TaskSchedule
To make a statement, this project is mainly based on a number of third-party components, questions or suggestions can be in this or GitHub to leave me a message, the actual process of the project is not responsible for any problems ^o^.
Open source a timed task frame under Windows, simple and rough to use.