Giter Club home page Giter Club logo

zcrontab's Introduction

ZCrontab

zcrontab is a crontab、at task processor based on golang:

  • based on time.ticker,no need of crond service

  • support task deletion and callback

  • crontab

    • the crontab task support all crontab symbol including *,-,/,,
  • at

    • the at task can be repeated at the same time(every day)

Usage

Install

glide get github.com/zzerroo/zcrontab

example

import (
	"fmt"
	"time"
	"ztimer/zcrontab"
)

func test(args interface{}) {
	fmt.Println(args)
}
 
func main() {
	zCrontab := zcrontab.NewZCrontab()
	zCrontab.Crontab("* * * * *", test, "*")
	zCrontab.Crontab("*/2 * * * *", test, "every 2 minute")
	zCrontab.Crontab("* 15 * * *", test, "every minute 3")
	zCrontab.Crontab("*/2 15,16 * * *", test, "every 2 minute 3,4")
	zCrontab.Crontab("*/2 15-16 * * *", test, "every 2 minute 3-4")
	zCrontab.Crontab("* 15-16/2 * * *", test, "every minute 3-4/3")
	zCrontab.At(time.Now().Add(1*time.Minute), test, "this is test for at repeat", true)
	zCrontab.At(time.Now().Add(1*time.Minute), test, "this is test for at", false)
	select {}
}

zcrontab's People

Contributors

zzerroo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gitqifan

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.