Skip to content

godump/cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cron

Package cron provides functionality for generate signals at intervals timed in January 1, 1970 UTC. According to most cases, cron can work with gracefulexit.

package main

import (
	"log"
	"time"

	"github.com/godump/cron"
	"github.com/godump/gracefulexit"
)

func main() {
	chanSpin := cron.Cron(time.Minute)
	chanExit := gracefulexit.Chan()
	done := 0
	log.Println("main: loop")
	for {
		select {
		case <-chanSpin:
			log.Println(time.Now())
		case <-chanExit:
			done = 1
		}
		if done != 0 {
			break
		}
	}
	log.Println("main: done")
}

Doc: https://godoc.org/github.com/godump/cron.

About

Daemon to execute scheduled commands

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages