feat: add cron schedule
This commit is contained in:
parent
2a477f49a2
commit
3508c5a26e
42
main.go
42
main.go
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -10,24 +11,29 @@ func main() {
|
|||
log.Fatalf("Could not create client: %s", err)
|
||||
}
|
||||
|
||||
updateFullBackupPath()
|
||||
for {
|
||||
updateFullBackupPath()
|
||||
|
||||
containers, err := getContainers(c)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not get containers: %s", err)
|
||||
containers, err := getContainers(c)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not get containers: %s", err)
|
||||
}
|
||||
|
||||
storeContainers(c, containers)
|
||||
|
||||
err = cleanupOldBackups()
|
||||
if err != nil {
|
||||
log.Fatalf("Could not clean old backups: %s", err)
|
||||
}
|
||||
|
||||
err = dumpAllDatabases(c)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not dump databases: %s", err)
|
||||
}
|
||||
|
||||
log.Println("Done.")
|
||||
log.Printf("Sleeping for %s\n", config.Interval)
|
||||
|
||||
time.Sleep(config.Interval)
|
||||
}
|
||||
|
||||
storeContainers(c, containers)
|
||||
|
||||
err = cleanupOldBackups()
|
||||
if err != nil {
|
||||
log.Fatalf("Could not clean old backups: %s", err)
|
||||
}
|
||||
|
||||
err = dumpAllDatabases(c)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not dump databases: %s", err)
|
||||
}
|
||||
|
||||
// TODO: Cron
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue