Documentation ¶
Index ¶
- Constants
- func CreateRunToken() string
- func ParseDayOfMonthIntoFilter(rawStr string) (func(testTime time.Time) bool, error)
- func ParseDayOfWeekIntoFilter(rawStr string) (func(testTime time.Time) bool, error)
- func ParseHourIntoFilter(rawStr string) (func(testTime time.Time) bool, error)
- func ParseMinuteIntoFilter(rawStr string) (func(testTime time.Time) bool, error)
- func ParseMonthIntoFilter(rawStr string) (func(testTime time.Time) bool, error)
- type ChanComm
- type JobConfig
- type JobConfigAPI
- type JobSchedule
- func (h *JobSchedule) CheckConfig() error
- func (h *JobSchedule) GetJobByID(jobID int) (JobConfig, error)
- func (h *JobSchedule) GetJobByLabel(title string) (JobConfig, int, error)
- func (h *JobSchedule) MakeAPIFormat() (JobScheduleAPI, error)
- func (h *JobSchedule) ParseJobConfig(confFile string) error
- func (h *JobSchedule) WriteJobConfig(confFile string) error
- type JobScheduleAPI
- type RunningJob
- type RunningJobAPI
- type RunningJobTracker
- type RunningJobTrackerAPI
Constants ¶
const ( DAYOFWEEK = 4 MONTH = 3 DAY = 2 HOUR = 1 MINUTE = 0 SUNDAY = "Sunday" MONDAY = "Monday" TUESDAY = "Tuesday" WEDNESDAY = "Wednesday" THURSDAY = "Thursday" FRIDAY = "Friday" SATURDAY = "Saturday" )
Variables ¶
This section is empty.
Functions ¶
func CreateRunToken ¶
func CreateRunToken() string
func ParseDayOfMonthIntoFilter ¶
ParseDayOfMonthIntoFilter - Translate schedule notation of a day in a month (1 - 32)
into a function that when called with a datetime, will tell you if the date is on that day of the month
func ParseDayOfWeekIntoFilter ¶
ParseDayOfWeekIntoFilter - Translate schedule notation of a day of the week (0: Sun - 6: Sat)
into a function that when called with a datetime will, tell you if the date is on that day
func ParseHourIntoFilter ¶
ParseHourIntoFilter - Translate schedule notation of an hour in a day (0 - 23)
into a function that when called with a datetime, will tell you if the time is currently in that hour
func ParseMinuteIntoFilter ¶
ParseMinuteIntoFilter - Translate schedule notation of a minute in an hour (0 - 59)
into a function that when called with a datetime, will tell you if the time is currently in that minute
Types ¶
type JobConfig ¶
type JobConfig struct { Label string // The name of the job. Used in logging Command string // String to be run on the system GroupName string // Used to relate jobs and in logging *unused* Schedule string // Traditional encoded string to represent the schedule Locking bool // Self-locking daemon that won't step on its own toes Filters []func(currentTime time.Time) bool }
JobConfig - Object representing a single scheduled job
func (*JobConfig) CheckIfScheduled ¶
CheckIfScheduled - Initiates each filter for a job and returns whether or not to run the job
func (*JobConfig) MakeAPIFormat ¶
func (j *JobConfig) MakeAPIFormat() (JobConfigAPI, error)
MakeAPIFormat - Convert internal object into external data
func (*JobConfig) ParseScheduleIntoFilters ¶
ParseScheduleIntoFilters - Translate schedule string into iterable functions
type JobConfigAPI ¶
type JobConfigAPI struct { Label string // The name of the job. Used in logging Command string // String to be run on the system GroupName string // Used to relate jobs and in logging *unused* Locking bool // Self-locking daemon that won't step on its own toes Schedule string // Traditional encoded string to represent the schedule }
JobConfigAPI - Object representing a single scheduled job and is JSON friendly for API use
type JobSchedule ¶
JobSchedule - Keep all the jobs together in an iterable slice
func (*JobSchedule) CheckConfig ¶
func (h *JobSchedule) CheckConfig() error
CheckConfig - Sanity checks on the JobSchedule and builds LabelToIndex. MUST BE RUN EVERYTIME THE RUNNING CONFIG IS CHANGED!
func (*JobSchedule) GetJobByID ¶
func (h *JobSchedule) GetJobByID(jobID int) (JobConfig, error)
GetJobByID - Find a job using its ID
func (*JobSchedule) GetJobByLabel ¶
func (h *JobSchedule) GetJobByLabel(title string) (JobConfig, int, error)
GetJobByTitle - Find a job using its title
func (*JobSchedule) MakeAPIFormat ¶
func (h *JobSchedule) MakeAPIFormat() (JobScheduleAPI, error)
MakeAPIFormat - Convert internal object into external data
func (*JobSchedule) ParseJobConfig ¶
func (h *JobSchedule) ParseJobConfig(confFile string) error
ParseJobConfig - Decode TOML config file and initiate ParseScheduleIntoFilters for each job
func (*JobSchedule) WriteJobConfig ¶
func (h *JobSchedule) WriteJobConfig(confFile string) error
WriteJobConfig - update the written config file with any changes that have occured
type JobScheduleAPI ¶
type JobScheduleAPI struct {
Job []JobConfigAPI
}
JobScheduleAPI - Keep all the jobs together in an iterable slice and is JSON friendly for API use
type RunningJob ¶
type RunningJob struct { Token string Config JobConfig Channel chan ChanComm Exec *exec.Cmd StdOut io.ReadCloser StdErr io.ReadCloser StartTime time.Time }
func (*RunningJob) DetermineLoggingDir ¶
func (r *RunningJob) DetermineLoggingDir() string
DetermineLoggingPath - Get the filepath to write new logs to
func (*RunningJob) MakeAPIFormat ¶
func (j *RunningJob) MakeAPIFormat(jobToken string) (RunningJobAPI, error)
MakeAPIFormat - Convert internal object into external data
func (*RunningJob) Run ¶
func (r *RunningJob) Run(running *RunningJobTracker)
Run - Executes command
type RunningJobAPI ¶
type RunningJobTracker ¶
type RunningJobTracker struct { Sync *sync.RWMutex Jobs map[string]RunningJob }
func (*RunningJobTracker) MakeAPIFormat ¶
func (t *RunningJobTracker) MakeAPIFormat() (RunningJobTrackerAPI, error)
MakeAPIFormat - Convert internal object into external data
type RunningJobTrackerAPI ¶
type RunningJobTrackerAPI struct {
Jobs []RunningJobAPI
}