mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-23 00:36:25 +00:00
Compare commits
1 Commits
076779c848
...
4ba39a8eda
Author | SHA1 | Date | |
---|---|---|---|
|
4ba39a8eda |
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e -o pipefail
|
|
||||||
shopt -s nocaseglob
|
shopt -s nocaseglob
|
||||||
|
|
||||||
OUT_FILE=/usr/local/bin/autorestic
|
OUT_FILE=/usr/local/bin/autorestic
|
||||||
|
@ -1,22 +1,12 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
func RunCron() error {
|
func RunCron() error {
|
||||||
c := GetConfig()
|
c := GetConfig()
|
||||||
var errs []error
|
|
||||||
for name, l := range c.Locations {
|
for name, l := range c.Locations {
|
||||||
l.name = name
|
l.name = name
|
||||||
if err := l.RunCron(); err != nil {
|
if err := l.RunCron(); err != nil {
|
||||||
errs = append(errs, err)
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs) > 0 {
|
|
||||||
return fmt.Errorf("Encountered errors during cron process:\n%w", errors.Join(errs...))
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -447,10 +446,7 @@ func (l Location) RunCron() error {
|
|||||||
now := time.Now()
|
now := time.Now()
|
||||||
if now.After(next) {
|
if now.After(next) {
|
||||||
lock.SetCron(l.name, now.Unix())
|
lock.SetCron(l.name, now.Unix())
|
||||||
errs := l.Backup(true, "")
|
l.Backup(true, "")
|
||||||
if len(errs) > 0 {
|
|
||||||
return fmt.Errorf("Failed to backup location \"%s\":\n%w", l.name, errors.Join(errs...))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if !flags.CRON_LEAN {
|
if !flags.CRON_LEAN {
|
||||||
colors.Body.Printf("Skipping \"%s\", not due yet.\n", l.name)
|
colors.Body.Printf("Skipping \"%s\", not due yet.\n", l.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user