Documentation
¶
Index ¶
- Variables
- type Handler
- type HandlerCrond
- func (h *HandlerCrond) Close()
- func (h *HandlerCrond) CreateJob(job JobConfig, schedules []*calendar.Event, permission string) error
- func (h *HandlerCrond) DisplayJobStatus(job JobConfig) error
- func (h *HandlerCrond) DisplayParsedSchedules(command string, events []*calendar.Event)
- func (h *HandlerCrond) DisplaySchedules(command string, schedules []string) error
- func (h *HandlerCrond) DisplayStatus(profileName string) error
- func (h *HandlerCrond) Init() error
- func (h *HandlerCrond) ParseSchedules(schedules []string) ([]*calendar.Event, error)
- func (h *HandlerCrond) RemoveJob(job JobConfig, permission string) error
- type HandlerSystemd
- func (h *HandlerSystemd) Close()
- func (h *HandlerSystemd) CreateJob(job JobConfig, schedules []*calendar.Event, permission string) error
- func (h *HandlerSystemd) DisplayJobStatus(job JobConfig) error
- func (h *HandlerSystemd) DisplayParsedSchedules(command string, events []*calendar.Event)
- func (h *HandlerSystemd) DisplaySchedules(command string, schedules []string) error
- func (h *HandlerSystemd) DisplayStatus(profileName string) error
- func (h *HandlerSystemd) Init() error
- func (h *HandlerSystemd) ParseSchedules(schedules []string) ([]*calendar.Event, error)
- func (h *HandlerSystemd) RemoveJob(job JobConfig, permission string) error
- type Job
- type JobConfig
- 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 SchedulerConfig
- type SchedulerCrond
- type SchedulerDefaultOS
- type SchedulerJob
- type SchedulerLaunchd
- type SchedulerSystemd
- type SchedulerWindows
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")
Functions ¶
This section is empty.
Types ¶
type Handler ¶ added in v0.16.1
type Handler interface {
Init() error
Close()
ParseSchedules(schedules []string) ([]*calendar.Event, error)
DisplayParsedSchedules(command string, events []*calendar.Event)
DisplaySchedules(command string, schedules []string) error
DisplayStatus(profileName string) error
CreateJob(job JobConfig, schedules []*calendar.Event, permission string) error
RemoveJob(job JobConfig, permission string) error
DisplayJobStatus(job JobConfig) error
}
func NewHandler ¶ added in v0.16.1
func NewHandler(config SchedulerConfig) Handler
NewHandler creates a crond or systemd handler depending on the configuration
type HandlerCrond ¶ added in v0.16.1
type HandlerCrond struct {
// contains filtered or unexported fields
}
HandlerCrond is a handler for crond scheduling
func NewHandlerCrond ¶ added in v0.16.1
func NewHandlerCrond(config SchedulerConfig) *HandlerCrond
NewHandlerCrond creates a new handler for crond scheduling
func (*HandlerCrond) Close ¶ added in v0.16.1
func (h *HandlerCrond) Close()
Close does nothing with crond
func (*HandlerCrond) CreateJob ¶ added in v0.16.1
func (h *HandlerCrond) CreateJob(job JobConfig, schedules []*calendar.Event, permission string) error
CreateJob is creating the crontab
func (*HandlerCrond) DisplayJobStatus ¶ added in v0.16.1
func (h *HandlerCrond) DisplayJobStatus(job JobConfig) error
DisplayJobStatus has nothing to display (crond doesn't provide running information)
func (*HandlerCrond) DisplayParsedSchedules ¶ added in v0.16.1
func (h *HandlerCrond) DisplayParsedSchedules(command string, events []*calendar.Event)
func (*HandlerCrond) DisplaySchedules ¶ added in v0.16.1
func (h *HandlerCrond) DisplaySchedules(command string, schedules []string) error
DisplaySchedules does nothing with launchd
func (*HandlerCrond) DisplayStatus ¶ added in v0.16.1
func (h *HandlerCrond) DisplayStatus(profileName string) error
DisplayStatus does nothing with launchd
func (*HandlerCrond) Init ¶ added in v0.16.1
func (h *HandlerCrond) Init() error
Init verifies crond is available on this system
func (*HandlerCrond) ParseSchedules ¶ added in v0.16.1
func (h *HandlerCrond) ParseSchedules(schedules []string) ([]*calendar.Event, error)
type HandlerSystemd ¶ added in v0.16.1
type HandlerSystemd struct {
// contains filtered or unexported fields
}
HandlerSystemd is a handler to schedule tasks using systemd
func NewHandlerSystemd ¶ added in v0.16.1
func NewHandlerSystemd(config SchedulerConfig) *HandlerSystemd
NewHandlerSystemd creates a new handler to schedule jobs using systemd
func (*HandlerSystemd) Close ¶ added in v0.16.1
func (h *HandlerSystemd) Close()
Close does nothing with systemd
func (*HandlerSystemd) CreateJob ¶ added in v0.16.1
func (h *HandlerSystemd) CreateJob(job JobConfig, schedules []*calendar.Event, permission string) error
CreateJob is creating the systemd unit and activating it
func (*HandlerSystemd) DisplayJobStatus ¶ added in v0.16.1
func (h *HandlerSystemd) DisplayJobStatus(job JobConfig) error
DisplayJobStatus displays information of a systemd service/timer
func (*HandlerSystemd) DisplayParsedSchedules ¶ added in v0.16.1
func (h *HandlerSystemd) DisplayParsedSchedules(command string, events []*calendar.Event)
DisplayParsedSchedules does nothing with systemd
func (*HandlerSystemd) DisplaySchedules ¶ added in v0.16.1
func (h *HandlerSystemd) DisplaySchedules(command string, schedules []string) error
DisplaySchedules displays the schedules through the systemd-analyze command
func (*HandlerSystemd) DisplayStatus ¶ added in v0.16.1
func (h *HandlerSystemd) DisplayStatus(profileName string) error
func (*HandlerSystemd) Init ¶ added in v0.16.1
func (h *HandlerSystemd) Init() error
Init verifies systemd is available on this system
func (*HandlerSystemd) ParseSchedules ¶ added in v0.16.1
func (h *HandlerSystemd) ParseSchedules(schedules []string) ([]*calendar.Event, error)
ParseSchedules always returns nil on systemd
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 JobConfig ¶ added in v0.16.1
type JobConfig 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)
}
JobConfig 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 Permission ¶
type Permission string
Permission is either system or user
const ( PermissionUser Permission = "user" PermissionSystem Permission = "system" )
Permission
func (Permission) String ¶
func (p Permission) String() string
String returns either "user" or "system"
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 struct {
// contains filtered or unexported fields
}
Scheduler
func NewScheduler ¶ added in v0.11.0
func NewScheduler(config SchedulerConfig, profileName string) *Scheduler
NewScheduler creates a Scheduler object
func (*Scheduler) DisplayStatus ¶ added in v0.11.0
func (s *Scheduler) DisplayStatus()
DisplayStatus
func (*Scheduler) NewJob ¶ added in v0.11.0
func (s *Scheduler) NewJob(config JobConfig) SchedulerJob
NewJob instantiates a Job object (of SchedulerJob interface) to schedule jobs
type SchedulerConfig ¶ added in v0.16.1
type SchedulerConfig interface {
// Type of scheduler config ("windows", "launchd", "crond", "systemd" or "" for OS default)
Type() string
}
func NewSchedulerConfig ¶ added in v0.16.1
func NewSchedulerConfig(global *config.Global) SchedulerConfig
type SchedulerCrond ¶ added in v0.16.1
func (SchedulerCrond) Type ¶ added in v0.16.1
func (s SchedulerCrond) Type() string
type SchedulerDefaultOS ¶ added in v0.16.1
type SchedulerDefaultOS struct{}
func (SchedulerDefaultOS) Type ¶ added in v0.16.1
func (s SchedulerDefaultOS) Type() string
type SchedulerJob ¶ added in v0.11.0
type SchedulerJob interface {
Accessible() bool
Create() error
Remove() error
RemoveOnly() bool
Status() error
}
SchedulerJob interface
type SchedulerLaunchd ¶ added in v0.16.1
func (SchedulerLaunchd) Type ¶ added in v0.16.1
func (s SchedulerLaunchd) Type() string
type SchedulerSystemd ¶ added in v0.16.1
func (SchedulerSystemd) Type ¶ added in v0.16.1
func (s SchedulerSystemd) Type() string
type SchedulerWindows ¶ added in v0.16.1
type SchedulerWindows struct{}
func (SchedulerWindows) Type ¶ added in v0.16.1
func (s SchedulerWindows) Type() string