Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

cmd: added --retries-sleep flag

Benjamin Joseph Dagda45dadfe9cf
diff --git a/cmd/cmd.go b/cmd/cmd.go
index d1dbab5bd..32b76908a 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -39,12 +39,13 @@ import (
// Globals
var (
// Flags
- cpuProfile = flags.StringP("cpuprofile", "", "", "Write cpu profile to file")
- memProfile = flags.StringP("memprofile", "", "", "Write memory profile to file")
- statsInterval = flags.DurationP("stats", "", time.Minute*1, "Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable)")
- dataRateUnit = flags.StringP("stats-unit", "", "bytes", "Show data rate in stats as either 'bits' or 'bytes'/s")
- version bool
- retries = flags.IntP("retries", "", 3, "Retry operations this many times if they fail")
+ cpuProfile = flags.StringP("cpuprofile", "", "", "Write cpu profile to file")
+ memProfile = flags.StringP("memprofile", "", "", "Write memory profile to file")
+ statsInterval = flags.DurationP("stats", "", time.Minute*1, "Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable)")
+ dataRateUnit = flags.StringP("stats-unit", "", "bytes", "Show data rate in stats as either 'bits' or 'bytes'/s")
+ version bool
+ retries = flags.IntP("retries", "", 3, "Retry operations this many times if they fail")
+ retriesInterval = flags.DurationP("retries-sleep", "", 0, "Interval between retrying operations if they fail, e.g 500ms, 60s, 5m. (0 to disable)")
// Errors
errorCommandNotFound = errors.New("command not found")
errorUncategorized = errors.New("uncategorized error")
@@ -322,6 +323,9 @@ func Run(Retry bool, showStats bool, cmd *cobra.Command, f func() error) {
if try < *retries {
accounting.Stats.ResetErrors()
}
+ if *retriesInterval > 0 {
+ time.Sleep(*retriesInterval)
+ }
}
if showStats {
close(stopStats)
diff --git a/docs/content/docs.md b/docs/content/docs.md
index 63ded42c3..7c2eeceaf 100644
--- a/docs/content/docs.md
+++ b/docs/content/docs.md
@@ -591,6 +591,12 @@ files which didn't get transferred because of errors.
Disable retries with `--retries 1`.
+### --retries-sleep=TIME ###
+
+This sets the interval between each retry specified by `--retries`
+
+The default is 0. Use 0 to disable.
+
### --size-only ###
Normally rclone will look at modification time and size of files to