Run rclone for a specific time or untill sync finishes?

Does rclone have an timmer functionality?
Like run rclone for 1 hour or untill the sync is completed?
And if so what flags should i use?
Thank

1 Like

We are working on a --max-duration flag but it isn't ready yet!

You can use --max-transfer to transfer up to a maximum of some data.

You can also use --bwlimit to schedule rclone's bandwidth use up and down which may be helpful.

1 Like

Awesome thanks @ncw

Feel free to @ me if you need this tested,
Not sure how long it will take for you to add this functionality,

Meanwhile it is of course possible to make a manually scripted timeout if you feel comfortable with batch or bash. Use a wrapper script to start the sync, run a timer, then terminate the process via one of many possible means (PID, a spesific window name ect.)

That would basically simulate the same result as the upcoming --max-duration flag.

If you are on windows and your need is great, I might be able to whip you up something quick to do this. I'm no batch wizard mind you - and I'm worse on Linux, but this isn't actually that hard to do.

timeout 1h rclone sync source: destination: works if your system has timeout

Although --max-duration will be fabulous as an in-rclone flag when it arrives!

2 Likes

timeout is a good option but the your syntax is not correct.
the wait time can only be specified in seconds, not minutes, not hours

Depends on your OS, in any Linux system, it's quite correct:

       DURATION is a floating point number with an optional suffix: 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days.  A duration of 0 disables the associated timeout.

       If  the  command  times  out, and --preserve-status is not set, then exit with status 124.  Otherwise, exit with the status of COMMAND.  If no signal is specified, send the TERM signal upon timeout.  The
       TERM signal kills any process that does not block or catch that signal.  It may be necessary to use the KILL (9) signal, since this signal cannot be caught, in which case the exit status is 128+9  rather
       than 124.

another option is task scheduler.

it has an option to 'stop a task if it runs longer than'

and an option to 'if the running task does not end when requested, force it to stop'

if you want to be able to run the task from the command line, make sure click the checkbox 'allow task to be run on demand'

if you wanted to start the task from the command line, use syntax like
"schtasks /run /tn "rclone\en07.veaamfull"

@Animosity022, sorry, I had thought the user was on windows.
as always, it seems that any linux command is always better than on the windows equivalent.

Works on linux, Mac OS and on windows (WSL / WSL2 are a happy place nowadays) :wink:

i have never trusted micro$oft and unix/linux.
i remember, when i was a radio shack bunkie, in the 1970's, there was a micro$oft xenix.
it was buggy and needed a lot of floppy discs.

When it comes to command-line, nothing could be more true.
But of course, you can always use powershell instead and that is actually quite powerful and up-to-par once you overcome the learning curve. old batch scripting is really a relic of the past that we by all rights should have replaced with powershell a long time ago. (and yet I haven't migrated so I guess I'm part of the problem lol)

well, that is true but i have found that writing large scripts with powershell is a pain in the glass.

  1. lack of pre-created/tested/supported modules for easy import.
  2. poor debugging.
  3. cryptic code.

so i script with python and use it to create and execute super simple .cmd.

Thank you for now il use timeout flag,

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.