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:
parent
6c841d29f4
commit
32259a0a6a
2 changed files with 6 additions and 1 deletions
|
@ -27,6 +27,10 @@ var (
|
||||||
commandBackup,
|
commandBackup,
|
||||||
commandRemove,
|
commandRemove,
|
||||||
}
|
}
|
||||||
|
removeCommands = []string{
|
||||||
|
commandBackup,
|
||||||
|
commandCleanup,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
type configFile struct {
|
type configFile struct {
|
||||||
|
|
3
main.go
3
main.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue