make backups

master
bel 2020-02-02 03:54:44 +00:00
parent c2ee5c2bc1
commit 0f396eb3d4
1 changed files with 7 additions and 5 deletions

12
main.go
View File

@ -9,7 +9,6 @@ import (
"log"
"os"
"os/signal"
"path"
"path/filepath"
"syscall"
"time"
@ -67,8 +66,8 @@ func EnqueueBackups() {
return
}
conf := lastn.Config{
N: 10,
Rclone: path.Dir(realpath) + "-backups",
N: 3,
Rclone: realpath + "-backups",
Root: realpath,
Ns: "backups",
Store: "rclone",
@ -80,14 +79,17 @@ func EnqueueBackups() {
log.Println("backups disabled:", realpath, ":", err)
return
}
ticker := time.NewTicker(time.Hour * 12)
ticker := time.NewTicker(time.Hour * 24)
if err := lastn.Push(); err != nil {
log.Println("backup failed:", err)
}
for _ = range ticker.C {
log.Println("backing up...")
if err := lastn.Push(); err != nil {
log.Println("backup failed:", err)
log.Println("backup push failed:", err)
}
if err := lastn.Clean(); err != nil {
log.Println("backup clean failed:", err)
}
}
}