Documentation
¶
Index ¶
- Variables
- type Config
- type CrondSchedule
- type Job
- type Permission
- type RemoveOnlyConfig
- func (r *RemoveOnlyConfig) Arguments() []string
- func (r *RemoveOnlyConfig) Command() string
- func (r *RemoveOnlyConfig) Configfile() string
- func (r *RemoveOnlyConfig) Environment() map[string]string
- func (r *RemoveOnlyConfig) GetFlag(string) (string, bool)
- func (r *RemoveOnlyConfig) JobDescription() string
- func (r *RemoveOnlyConfig) Logfile() string
- func (r *RemoveOnlyConfig) Permission() string
- func (r *RemoveOnlyConfig) Priority() string
- func (r *RemoveOnlyConfig) Schedules() []string
- func (r *RemoveOnlyConfig) SubTitle() string
- func (r *RemoveOnlyConfig) TimerDescription() string
- func (r *RemoveOnlyConfig) Title() string
- func (r *RemoveOnlyConfig) WorkingDirectory() string
- type Scheduler
- type SchedulerJob
- type SystemdSchedule
Constants ¶
This section is empty.
Variables ¶
var ( ErrorServiceNotFound = errors.New("service not found") ErrorServiceNotRunning = errors.New("service is not running") )
Generic errors
var ErrorJobCanBeRemovedOnly = errors.New("job can be removed only")
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
func NewRemoveOnlyConfig ¶ added in v0.12.0
NewRemoveOnlyConfig creates a job config that may be used to call Job.Remove() on a scheduled 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) Accessible ¶ added in v0.12.0
Accessible checks if the current user is permitted to access the job
func (*Job) RemoveOnly ¶ added in v0.12.0
RemoveOnly returns true if this job can be removed only
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 RemoveOnlyConfig ¶ added in v0.12.0
type RemoveOnlyConfig struct {
// contains filtered or unexported fields
}
RemoveOnlyConfig implements Config for jobs that are Job.RemoveOnly()
func (*RemoveOnlyConfig) Arguments ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Arguments() []string
func (*RemoveOnlyConfig) Command ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Command() string
func (*RemoveOnlyConfig) Configfile ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Configfile() string
func (*RemoveOnlyConfig) Environment ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Environment() map[string]string
func (*RemoveOnlyConfig) GetFlag ¶ added in v0.12.0
func (r *RemoveOnlyConfig) GetFlag(string) (string, bool)
func (*RemoveOnlyConfig) JobDescription ¶ added in v0.12.0
func (r *RemoveOnlyConfig) JobDescription() string
func (*RemoveOnlyConfig) Logfile ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Logfile() string
func (*RemoveOnlyConfig) Permission ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Permission() string
func (*RemoveOnlyConfig) Priority ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Priority() string
func (*RemoveOnlyConfig) Schedules ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Schedules() []string
func (*RemoveOnlyConfig) SubTitle ¶ added in v0.12.0
func (r *RemoveOnlyConfig) SubTitle() string
func (*RemoveOnlyConfig) TimerDescription ¶ added in v0.12.0
func (r *RemoveOnlyConfig) TimerDescription() string
func (*RemoveOnlyConfig) Title ¶ added in v0.12.0
func (r *RemoveOnlyConfig) Title() string
func (*RemoveOnlyConfig) WorkingDirectory ¶ added in v0.12.0
func (r *RemoveOnlyConfig) WorkingDirectory() 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
NewScheduler creates a Scheduler interface, which is either a CrondSchedule or a SystemdSchedule object
type SchedulerJob ¶ added in v0.11.0
type SchedulerJob interface {
Accessible() bool
Create() error
Remove() error
RemoveOnly() bool
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