This commit is contained in:
cupcakearmy 2021-04-12 00:17:29 +02:00
parent 03ca0c8677
commit d293e93fa8
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9
2 changed files with 6 additions and 9 deletions

View File

@ -3,8 +3,7 @@ package internal
func RunCron() error {
c := GetConfig()
for _, l := range c.Locations {
err := l.RunCron()
if err != nil {
if err := l.RunCron(); err != nil {
return err
}
}

View File

@ -207,16 +207,14 @@ func (l Location) RunCron() error {
if err != nil {
return err
}
last := lock.GetCron("test")
fmt.Println(last)
next := schedule.Next(time.Unix(last, 0))
fmt.Println(next)
last := time.Unix(lock.GetCron(l.Name), 0)
next := schedule.Next(last)
now := time.Now()
if now.After(next) {
fmt.Println("Running")
lock.SetCron("test", now.Unix())
lock.SetCron(l.Name, now.Unix())
l.Backup()
} else {
fmt.Println("Not due yet")
fmt.Printf("Skipping \"%s\", not due yet.\n", l.Name)
}
return nil
}