mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 08:16:25 +00:00
Compare commits
4 Commits
4ba39a8eda
...
076779c848
Author | SHA1 | Date | |
---|---|---|---|
|
076779c848 | ||
|
8a773856de | ||
|
41e4e4a5f3 | ||
|
d332f4476b |
@ -34,7 +34,7 @@ Then paste this at the bottom of the file and save it. Note that in this specifi
|
||||
|
||||
```bash
|
||||
# This is required, as it otherwise cannot find restic as a command.
|
||||
PATH="/usr/local/bin:/usr/bin:/bin"
|
||||
PATH="/usr/local/bin:$PATH"
|
||||
|
||||
# Example running every 5 minutes
|
||||
*/5 * * * * autorestic -c /path/to/my/.autorestic.yml --ci cron
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
shopt -s nocaseglob
|
||||
|
||||
OUT_FILE=/usr/local/bin/autorestic
|
||||
|
@ -1,12 +1,22 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func RunCron() error {
|
||||
c := GetConfig()
|
||||
var errs []error
|
||||
for name, l := range c.Locations {
|
||||
l.name = name
|
||||
if err := l.RunCron(); err != nil {
|
||||
return err
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
return fmt.Errorf("Encountered errors during cron process:\n%w", errors.Join(errs...))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@ -446,7 +447,10 @@ func (l Location) RunCron() error {
|
||||
now := time.Now()
|
||||
if now.After(next) {
|
||||
lock.SetCron(l.name, now.Unix())
|
||||
l.Backup(true, "")
|
||||
errs := l.Backup(true, "")
|
||||
if len(errs) > 0 {
|
||||
return fmt.Errorf("Failed to backup location \"%s\":\n%w", l.name, errors.Join(errs...))
|
||||
}
|
||||
} else {
|
||||
if !flags.CRON_LEAN {
|
||||
colors.Body.Printf("Skipping \"%s\", not due yet.\n", l.name)
|
||||
|
Loading…
Reference in New Issue
Block a user