1
0
Fork 0
mirror of https://github.com/Luzifer/duplicity-backup.git synced 2024-11-09 15:40:06 +00:00

Do backup removes only after certain commands

This commit is contained in:
Knut Ahlers 2016-05-23 11:59:23 +02:00
parent 6c841d29f4
commit 32259a0a6a
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 6 additions and 1 deletions

View file

@ -27,6 +27,10 @@ var (
commandBackup, commandBackup,
commandRemove, commandRemove,
} }
removeCommands = []string{
commandBackup,
commandCleanup,
}
) )
type configFile struct { type configFile struct {

View file

@ -10,6 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/Luzifer/go_helpers/str"
"github.com/Luzifer/go_helpers/which" "github.com/Luzifer/go_helpers/which"
"github.com/Luzifer/rconfig" "github.com/Luzifer/rconfig"
"github.com/mitchellh/go-homedir" "github.com/mitchellh/go-homedir"
@ -117,7 +118,7 @@ func main() {
return return
} }
if config.Cleanup.Type != "none" { if config.Cleanup.Type != "none" && str.StringInSlice(argv[1], removeCommands) {
logf("++++ Starting removal of old backups") logf("++++ Starting removal of old backups")
if err := execute(config, []string{commandRemove}); err != nil { if err := execute(config, []string{commandRemove}); err != nil {