crond

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEntryNoMatch = errors.New("line doesn't match a typical resticprofile entry")
)
View Source
var (
	ErrNoCrontabFile = errors.New("no crontab file was specified")
)

Functions

This section is empty.

Types

type Crontab

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

func NewCrontab

func NewCrontab(entries []Entry) (c *Crontab)

func (*Crontab) GetEntries added in v0.30.0

func (c *Crontab) GetEntries() ([]Entry, error)

func (*Crontab) LoadCurrent

func (c *Crontab) LoadCurrent() (content string, err error)

func (*Crontab) Remove

func (c *Crontab) Remove() (int, error)

func (*Crontab) Rewrite

func (c *Crontab) Rewrite() error

func (*Crontab) SetBinary added in v0.27.0

func (c *Crontab) SetBinary(crontabBinary string) *Crontab

SetBinary sets the crontab binary to use for reading and writing the crontab (if empty, SetFile must be used)

func (*Crontab) SetFile added in v0.27.0

func (c *Crontab) SetFile(file string) *Crontab

SetFile toggles whether to read & write a crontab file instead of using the crontab binary

func (*Crontab) SetFs added in v0.30.0

func (c *Crontab) SetFs(fs afero.Fs) *Crontab

SetFs sets the filesystem to use for reading and writing the crontab file. If not set, it will use the default filesystem.

type Entry

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

Entry represents a new line in the crontab

func NewEntry

func NewEntry(event *calendar.Event, configFile, profileName, commandName, commandLine, workDir string) Entry

NewEntry creates a new crontab entry

func (Entry) CommandLine added in v0.30.0

func (e Entry) CommandLine() string

func (Entry) CommandName added in v0.30.0

func (e Entry) CommandName() string

func (Entry) ConfigFile added in v0.30.0

func (e Entry) ConfigFile() string

func (Entry) Event added in v0.30.0

func (e Entry) Event() *calendar.Event

Event returns the calendar event associated with this entry

func (Entry) Generate

func (e Entry) Generate(w io.StringWriter) error

Generate writes a cron line in the StringWriter (end of line included)

func (Entry) HasUser added in v0.27.0

func (e Entry) HasUser() bool

func (Entry) NeedsUser added in v0.27.0

func (e Entry) NeedsUser() bool

func (Entry) ProfileName added in v0.30.0

func (e Entry) ProfileName() string

func (Entry) SkipUser added in v0.27.0

func (e Entry) SkipUser() bool

func (Entry) String

func (e Entry) String() string

String returns the crontab line representation of the entry (end of line included)

func (Entry) User added in v0.30.0

func (e Entry) User() string

func (Entry) WithUser added in v0.27.0

func (e Entry) WithUser(user string) Entry

WithUser creates a new entry that adds a user that should run the command

func (Entry) WorkDir added in v0.30.0

func (e Entry) WorkDir() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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