Code Monkey home page Code Monkey logo

njob's Introduction

轻便作业调度器

使用方法

Install-Package NJob

//假设运行在控制台
var j = new NJob();

j.Run += (a, b) => {
    string logObj = b.Name;
    System.Net.WebClient wc = new System.Net.WebClient();
    wc.Encoding = Encoding.UTF8;
    string ret = wc.DownloadString(b.RunParam);
    ret = string.Format("{0} {1} 第{3}次执行结果:{2}", DateTime.Now, logObj, ret, b.RunTimes);

    Console.WriteLine(ret);
    Console.Write(DateTime.Now);
};
j.Error += (a, b) => {
    //b.Def.RunParam
    Console.WriteLine("{0} {1} 发生错误:", DateTime.Now, b.Def, b.Exception.Message);
};

j.Start();

Console.WriteLine("...");
Console.ReadKey();
j.Stop();

配置说明

配置文件内容修改后,NJob 会自动加载重新计算定时器

; 和 # 匀为行注释
;SEC:				按秒触发
;MIN:				按分触发
;HOUR:				按时触发
;DAY:				按天触发
;RunOnDay:			每天 什么时间 触发
;RunOnWeek:			星期几 什么时间 触发
;RunOnMonth:			每月 第几天 什么时间 触发

;Name1		SEC		2			/schedule/test002.aspx
;Name2		MIN		2			/schedule/test002.aspx
;Name3		HOUR		1			/schedule/test002.aspx
;Name4		DAY		2			/schedule/test002.aspx

;Name5		RunOnDay	15:55:59		/schedule/test002.aspx
;每天15点55分59秒

;Name6		RunOnWeek	1:15:55:59		/schedule/test002.aspx
;每星期一15点55分59秒

;Name7		RunOnMonth	1:15:55:59		/schedule/test002.aspx
;每月1号15点55分59秒

Example

https://github.com/2881099/robot_test

njob's People

Contributors

2881099 avatar

Watchers

James Cloos avatar li-shaoke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.