crontab

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package crontab deals with the standard 5-elements crontab input from a file also supports @descriptors like

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobSpec

type JobSpec struct {
	Spec    string
	Command string
}

JobSpec for spec and cmd + params

func Parse

func Parse(line string) (result JobSpec, err error)

Parse spec+command and return JobSpec

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser file, thread safe

func New

func New(file string, updInterval time.Duration, hupCh <-chan struct{}) *Parser

New creates Parser for file, but not parsing yet

func (Parser) Changes

func (p Parser) Changes(ctx context.Context) (<-chan []JobSpec, error)

Changes gets updates channel. Each time crontab file updated and modification time changed it will get parsed and the full list of jobs will be sent to the channel. Update checked periodically and postponed for short time to prevent changes on every small intermediate save. In addition it also performs forced reload on hupCh event.

func (Parser) List

func (p Parser) List() (result []JobSpec, err error)

List parses crontab and returns lit of jobs

func (Parser) String

func (p Parser) String() string

type Single

type Single struct {
	// contains filtered or unexported fields
}

Single provides crontab interface for a single command

func NewSingle added in v1.0.0

func NewSingle(line string) *Single

NewSingle creates crontab for a single command

func (Single) Changes

func (s Single) Changes(context.Context) (<-chan []JobSpec, error)

Changes not implemented

func (Single) List

func (s Single) List() (result []JobSpec, err error)

List parses the Line and return JobSpec for it

func (Single) String

func (s Single) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL