cron
This commit is contained in:
parent
e72050b3dc
commit
da60175fcc
2 changed files with 30 additions and 6 deletions
|
@ -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.
|
||||||
|
|
15
main.go
15
main.go
|
@ -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,6 +243,9 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cron := cCtx.Bool("cron")
|
||||||
|
|
||||||
|
if !cron {
|
||||||
fmt.Println("Write \"yes\" to execute")
|
fmt.Println("Write \"yes\" to execute")
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
text, _ := reader.ReadString('\n')
|
text, _ := reader.ReadString('\n')
|
||||||
|
@ -251,6 +259,13 @@ func main() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
err = jobStorage.Delete(allFilesToDeleted)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("cant delete files from storage")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue