diff --git a/agent/tasks_windows.go b/agent/tasks_windows.go index 01ba56b..8a26fc0 100644 --- a/agent/tasks_windows.go +++ b/agent/tasks_windows.go @@ -110,22 +110,23 @@ func (a *WindowsAgent) CreateInternalTask(name, args, repeat string, start int) } type SchedTask struct { - PK int `json:"pk"` - Type string `json:"type"` - Name string `json:"name"` - Trigger string `json:"trigger"` - Enabled bool `json:"enabled"` - DeleteAfter bool `json:"deleteafter"` - WeekDays taskmaster.DayOfWeek `json:"weekdays"` - Year int `json:"year"` - Month string `json:"month"` - Day int `json:"day"` - Hour int `json:"hour"` - Minute int `json:"min"` - Path string `json:"path"` - WorkDir string `json:"workdir"` - Args string `json:"args"` - Parallel bool `json:"parallel"` + PK int `json:"pk"` + Type string `json:"type"` + Name string `json:"name"` + Trigger string `json:"trigger"` + Enabled bool `json:"enabled"` + DeleteAfter bool `json:"deleteafter"` + WeekDays taskmaster.DayOfWeek `json:"weekdays"` + Year int `json:"year"` + Month string `json:"month"` + Day int `json:"day"` + Hour int `json:"hour"` + Minute int `json:"min"` + Path string `json:"path"` + WorkDir string `json:"workdir"` + Args string `json:"args"` + Parallel bool `json:"parallel"` + RunASAPAfterMissed bool `json:"run_asap_after_missed"` } func (a *WindowsAgent) CreateSchedTask(st SchedTask) (bool, error) { @@ -221,6 +222,10 @@ func (a *WindowsAgent) CreateSchedTask(st SchedTask) (bool, error) { def.Settings.MultipleInstances = taskmaster.TASK_INSTANCES_IGNORE_NEW } + if st.RunASAPAfterMissed { + def.Settings.StartWhenAvailable = true + } + _, success, err := conn.CreateTask(fmt.Sprintf("\\%s", st.Name), def, true) if err != nil { a.Logger.Errorln(err)