Open source a timed task frame under Windows, simple and rough to use.

Source: Internet
Author: User

Here are the features you want:
    1. 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.
    2. Supports corn expressions. You want the task to execute when it is executed.
    3. Support for installation into Windows service (implemented via Topshelf)
    4. Ensure that the task is in the execution phase, even when the next trigger time is not repeated (if this is not done).
    5. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.