Skip to content

JPZ13/daemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GoDoc

import (
	"fmt"
  	"time"

	"github.com/JPZ13/daemon"
)

// plug in any function that takes no arguments
// and returns an error
func action() error {
	return nil
}

func main() {
	dae := daemon.New(daemon.Config{
		Action:   action,
		Interval: 2 * time.Minute,
	})

	errCh := dae.Start()
	go func() {
		for err := range errCh {
			fmt.Println("Handling error ", err)
		}
	}()

	time.Sleep(5 * time.Minute)

	dae.Stop()
}

About

😈 Repeat tasks the metal way

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages