diff --git a/admin.go b/admin.go index 278c4b3..2838c69 100644 --- a/admin.go +++ b/admin.go @@ -90,6 +90,7 @@ func (a *AdminConfig) Run() { log.WithFields(log.Fields{"call": "cron.AddFunc", "error": err}).Errorf("") } c.Start() + log.WithFields(log.Fields{"call": "cron.Start"}).Debugf("cron started") // Listen for the interrupt signal. <-ctx.Done() diff --git a/app.go b/app.go index fd3d1ab..d2ffa13 100644 --- a/app.go +++ b/app.go @@ -281,47 +281,47 @@ func (a *App) RunSchedule(schedule string, now time.Time) error { } -func (a *App) Run(now time.Time) error { +func (a *App) Run(now time.Time) (string, error) { log.WithFields(log.Fields{"app": a.name, "now": now}).Debugf("starting") defer log.WithFields(log.Fields{"app": a.name, "now": now}).Debugf("done") if err := a.SanityCheck(); err != nil { log.WithFields(log.Fields{"app": a.name, "now": now, "call": "SanityCheck", "error": err}).Errorf("") - return err + return "", err } schedule, err := a.NextSchedule(now) if err != nil { log.WithFields(log.Fields{"app": a.name, "call": "NextSchedule", "error": err}).Errorf("") - return err + return "", err } log.WithFields(log.Fields{"app": a.name, "now": now, "schedule": schedule}).Debugf("schedule") if schedule != "" { if err := a.RunSchedule(schedule, now); err != nil { log.WithFields(log.Fields{"app": a.name, "call": "NextSchedule", "error": err}).Errorf("") - return err + return "", err } } for _, src := range a.sources { if err := src.SetManaged(true); err != nil { log.WithFields(log.Fields{"app": a.name, "call": "src.SetManaged", "error": err}).Errorf("") - return err + return "", err } } if err := a.Transfer(); err != nil { log.WithFields(log.Fields{"app": a.name, "call": "Transfer", "error": err}).Errorf("") - return err + return "", err } if err := a.Cleanup(now); err != nil { log.WithFields(log.Fields{"app": a.name, "call": "Cleanup", "error": err}).Errorf("") - return err + return "", err } - return nil + return schedule, nil } func (a *App) NextSchedule(now time.Time) (string, error) { diff --git a/config.go b/config.go index f398540..4301d2a 100644 --- a/config.go +++ b/config.go @@ -181,8 +181,10 @@ func (c *Config) Run() { for _, a := range cfg.apps { wg.Add(1) go func(app *App) { - if err := app.Run(e.startTime); err != nil { + if sched, err := app.Run(e.startTime); err != nil { e.AddItem(fmt.Sprintf(" - App : Error running %s (%s)", app.name, err)) + } else if *debug { + e.AddItem(fmt.Sprintf(" - App : Success backing up %s (%s)", app.name, sched)) } wg.Done() }(a) diff --git a/version.go b/version.go index a4c7b7d..091c47b 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "54a16bd" +var githash = "8ecde23" var branch = "v2" -var buildstamp = "2023-07-31_23:22:29" -var commits = "78" -var version = "54a16bd-b78 - 2023-07-31_23:22:29" +var buildstamp = "2023-08-01_07:34:30" +var commits = "79" +var version = "8ecde23-b79 - 2023-08-01_07:34:30"