This commit is contained in:
kekskurse 2023-10-14 15:24:49 +02:00
parent e72050b3dc
commit da60175fcc
2 changed files with 30 additions and 6 deletions

View file

@ -144,6 +144,15 @@ The job argument is optional and can be used to show just the plan of on job bas
### Cron run ### Cron run
Execute the deletion, **without** ask before deleting the files
```
idun execute -job abc2 -cron
```
The job argument is optional and can be used to show just the plan of on job based on the "name" in the config.
## FAQ ## FAQ
### Why minimum Hour/Day/Month ### Why minimum Hour/Day/Month
If you configure to keep one backup per hour for 12 hours Idun will make sure there will be hourly backups for at least 12 hours. But based on the rules of the next Buckets, which is per Day from 00:00:00 UTC to 23:59:59 UTC there may be a gap between the end hour of the "Hourly Bucket" and the beginn of the "Daily Bucket", in this case Iduna will not delete the Backup files. So ther will be up to 35 Hours Hourly Backups. If you configure to keep one backup per hour for 12 hours Idun will make sure there will be hourly backups for at least 12 hours. But based on the rules of the next Buckets, which is per Day from 00:00:00 UTC to 23:59:59 UTC there may be a gap between the end hour of the "Hourly Bucket" and the beginn of the "Daily Bucket", in this case Iduna will not delete the Backup files. So ther will be up to 35 Hours Hourly Backups.

27
main.go
View file

@ -172,6 +172,11 @@ func main() {
Value: "config.yml", Value: "config.yml",
Usage: "path to config", Usage: "path to config",
}, },
&cli.BoolFlag{
Name: "cron",
Value: false,
Usage: "Run as cron, dont ask for yes",
},
}, },
Action: func(cCtx *cli.Context) error { Action: func(cCtx *cli.Context) error {
configPath := cCtx.String("path") configPath := cCtx.String("path")
@ -238,13 +243,23 @@ func main() {
} }
} }
fmt.Println("Write \"yes\" to execute") cron := cCtx.Bool("cron")
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('\n')
// convert CRLF to LF
text = strings.Replace(text, "\n", "", -1)
if text == "yes" { if !cron {
fmt.Println("Write \"yes\" to execute")
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('\n')
// convert CRLF to LF
text = strings.Replace(text, "\n", "", -1)
if text == "yes" {
err = jobStorage.Delete(allFilesToDeleted)
if err != nil {
log.Fatal().Err(err).Msg("cant delete files from storage")
return err
}
}
} else {
err = jobStorage.Delete(allFilesToDeleted) err = jobStorage.Delete(allFilesToDeleted)
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("cant delete files from storage") log.Fatal().Err(err).Msg("cant delete files from storage")