Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions schedule/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Config struct {
Flags map[string]string // flags added to the command line
AfterNetworkOnline bool
SystemdDropInFiles []string
Log string
HideWindow bool
removeOnly bool
}
Expand Down
11 changes: 8 additions & 3 deletions schedule/handler_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,14 @@ func (h *HandlerLaunchd) Scheduled(profileName string) ([]Config, error) {

func (h *HandlerLaunchd) getLaunchdJob(job *Config, schedules []*calendar.Event) *darwin.LaunchdJob {
name := getJobName(job.ProfileName, job.CommandName)
// we always set the log file in the job settings as a default
// if changed in the configuration via schedule-log the standard output will be empty anyway
logfile := name + ".log"
// Only set the log file when schedule-log is not configured.
// When schedule-log is set, resticprofile handles logging internally,
// so we omit StandardOutPath/StandardErrorPath from the plist to avoid
// creating empty log files (the plist fields have omitempty tags).
var logfile string
if job.Log == "" {
logfile = name + ".log"
}

// Format schedule env, adding PATH if not yet provided by the schedule config
env := util.NewDefaultEnvironment(job.Environment...)
Expand Down
1 change: 1 addition & 0 deletions schedule_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,6 @@ func scheduleToConfig(sched *config.Schedule) *schedule.Config {
AfterNetworkOnline: sched.AfterNetworkOnline.IsTrue(),
SystemdDropInFiles: sched.SystemdDropInFiles,
HideWindow: sched.HideWindow.IsTrue(),
Log: sched.Log,
}
}
Loading