cron

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cron

type Cron struct {
	Minute        Value `json:"minute"`
	Hour          Value `json:"hour"`
	DayOfTheMonth Value `json:"dayOfTheMonth"`
	Month         Value `json:"month"`
	DayOfTheWeek  Value `json:"dayOfTheWeek"`
}

Cron defines the cron structure

func Parse

func Parse(s string) (*Cron, error)

Parse parses the given string and returns its Cron representation. Parsing only considers the first 5 elements, ignoring the rest.

func (*Cron) Format

func (c *Cron) Format(user, cmd string) string

Format returns a formatted line that can be added to a crontab

func (*Cron) IsValid

func (c *Cron) IsValid() bool

IsValid returns true if the cron values are valid

func (*Cron) IsZero

func (c *Cron) IsZero() bool

IsZero returns true if cron is empry

func (*Cron) String

func (c *Cron) String() string

type Install

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

Install builds and installs a crontab

func NewInstall

func NewInstall(comment string) *Install

NewInstall returns a new crontab installer

func (*Install) Add

func (i *Install) Add(c *Cron, user, cmd string) error

Add adds entry to the installer

func (*Install) AsSystem

func (i *Install) AsSystem(name string) error

AsSystem installs the entries to the system-wide crontab

func (*Install) AsUser

func (i *Install) AsUser() error

AsUser installs the crontab as user. It invokes the crontab command for the operation.

type Value

type Value string

Value defines the value type

func (Value) IsZero

func (v Value) IsZero() bool

IsZero returns true if value is empry

Jump to

Keyboard shortcuts

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