schedule

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorServiceNotFound   = errors.New("service not found")
	ErrorServiceNotRunning = errors.New("service is not running")
)

Generic errors

View Source
var (
	// ScheduledSections are the command that can be scheduled (backup, retention, check, prune)
	ScheduledSections = []string{
		constants.CommandBackup,
		constants.SectionConfigurationRetention,
		constants.CommandCheck,
		constants.CommandForget,
		constants.CommandPrune,
	}
)

Functions

This section is empty.

Types

type Config

type Config interface {
	Title() string
	SubTitle() string
	JobDescription() string
	TimerDescription() string
	Schedules() []string
	Permission() string
	WorkingDirectory() string
	Command() string
	Arguments() []string
	Environment() map[string]string
	Priority() string
	Logfile() string
	Configfile() string
	GetFlag(string) (string, bool)
}

Config contains all the information needed to schedule a Job

type CrondSchedule added in v0.11.0

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

CrondSchedule is a Scheduler using crond

func (*CrondSchedule) Close added in v0.11.0

func (s *CrondSchedule) Close()

Close does nothing when using crond

func (*CrondSchedule) DisplayStatus added in v0.11.0

func (s *CrondSchedule) DisplayStatus()

DisplayStatus does nothing in crond

func (*CrondSchedule) Init added in v0.11.0

func (s *CrondSchedule) Init() error

Init verifies crond is available on this system

func (*CrondSchedule) NewJob added in v0.11.0

func (s *CrondSchedule) NewJob(config Config) SchedulerJob

NewJob instantiates a Job object (of SchedulerJob interface) to schedule jobs

type Job

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

Job scheduler

func (*Job) Create

func (j *Job) Create() error

Create a new job

func (*Job) Remove

func (j *Job) Remove() error

Remove a job

func (*Job) Status

func (j *Job) Status() error

Status of a job

type Permission

type Permission int

Permission is either system or user

const (
	PermissionUser Permission = iota
	PermissionSystem
)

Permission

func (Permission) String

func (p Permission) String() string

type Scheduler added in v0.11.0

type Scheduler interface {
	Init() error
	Close()
	NewJob(Config) SchedulerJob
	DisplayStatus()
}

Scheduler interface

func NewScheduler added in v0.11.0

func NewScheduler(scheduler, profileName string) Scheduler

NewScheduler creates a Scheduler interface, which is either a CrondSchedule or a SystemdSchedule object

type SchedulerJob added in v0.11.0

type SchedulerJob interface {
	Create() error
	Remove() error
	Status() error
}

SchedulerJob interface

type SystemdSchedule added in v0.11.0

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

SystemdSchedule is a Scheduler using systemd

func (*SystemdSchedule) Close added in v0.11.0

func (s *SystemdSchedule) Close()

Close does nothing when using systemd

func (*SystemdSchedule) DisplayStatus added in v0.11.0

func (s *SystemdSchedule) DisplayStatus()

DisplayStatus display timers in systemd

func (*SystemdSchedule) Init added in v0.11.0

func (s *SystemdSchedule) Init() error

Init verifies systemd is available on this system

func (*SystemdSchedule) NewJob added in v0.11.0

func (s *SystemdSchedule) NewJob(config Config) SchedulerJob

NewJob instantiates a Job object (of SchedulerJob interface) to schedule jobs

Jump to

Keyboard shortcuts

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