crontab

package
Version: v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 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) *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.

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 {
	Line string
}

Single provides crontab interface 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