Documentation
¶
Overview ¶
Package tasks provides helpers for managing scheduled tasks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTaskNotFound indicates a failure due to task resolution ErrTaskNotFound = errors.New("task not found") // ErrNotRegistered indicates that the querired Scheduled Task // is not registered in the Windows Task Scheduler ErrNotRegistered = errors.New("scheduled task is not registered") )
Functions ¶
func Create ¶
func Create(id, path, args, name, user string, trigger taskmaster.Trigger) error
Create attempts to create a scheduled task.
Set common defaults for name and user to reduce the amount of required args.
Example taskmaster.Trigger that creates a new task on startup with a two minute delay:
taskmaster.BootTrigger{ TaskTrigger: taskmaster.TaskTrigger{ Enabled: true, ID: "startup", }, Delay: period.NewHMS(0, 2, 0), },
func Start ¶
Start attempts to start a scheduled task. This helper does not follow the running task or wait for execution to complete.
func TaskExists ¶
TaskExists is a helper function that detects whether a scheduled task exists.
Types ¶
type TaskInfo ¶
type TaskInfo struct { Name string State taskmaster.TaskState LastTaskResult taskmaster.TaskResult NextRunTime time.Time LastRunTime time.Time }
TaskInfo describes a registered task using data from taskmaster.RegisteredTask.
Click to show internal directories.
Click to hide internal directories.