cron

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package cron implements Crontab specification as defined in

The Open Group Base Specifications Issue 7, 2018 edition IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html

In addition to the standard, this package also implements the */15 syntax I am thinking about removing this as the step syntax doesn't make that much sense to me but the implementation is only an additional stack so it's ok to stay for now.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagSet

type FlagSet struct {
	flag.FlagSet
	// contains filtered or unexported fields
}

FlagSet is a cron FlagSet

func NewFlagSet

func NewFlagSet(name string, errorhandling flag.ErrorHandling) *FlagSet

NewFlagSet returns a new cron flagset

func (*FlagSet) CronTab

func (f *FlagSet) CronTab() string

CronTab prints a very nice explanatinon of what things do

Example
fset := NewFlagSet("test", flag.PanicOnError)
fset.Parse(strings.Fields("*/15 0 1,15 * 1-5 /usr/bin/find")...)
fmt.Println(fset.CronTab())
Output:

┌───────────────────minutes           [0s 15m0s 30m0s 45m0s]
│    ┌──────────────hours             [0s]
│    │ ┌────────────days of the month [1 15]
│    │ │    ┌───────months            [January February March April May June July August September October November December]
│    │ │    │ ┌─────days of the week  [Monday Tuesday Wednesday Thursday Friday]
│    │ │    │ │   ┌─args              [/usr/bin/find]
*/15 0 1,15 * 1-5 /usr/bin/find

func (*FlagSet) CronTab2

func (f *FlagSet) CronTab2() string

CronTab2 is pretty minimal, it prints a table but doen't explain stuff

func (*FlagSet) Parse

func (f *FlagSet) Parse(args ...string) error

Parse parses the strings in to a cronexpr flagset

type Parser

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

Parser is a cronexp parser.

func (*Parser) Parse

func (p *Parser) Parse(args []string) error

Parse parses args. These are usually os.Args

Jump to

Keyboard shortcuts

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