.config, file locking, auth token expiration

Using rclone to sync content with box.com, the authorization token by default has a short expiration date (seems to be typically 30-60 minutes). But rclone automatically extends the token, so it should be no problem as long as rclone is run frequently.

I am worried about two things:

  • If I write a script that runs rclone in an infinite while-loop (with sleep statement) something could kill my script or a single run of rclone might hang indefinitely if something went wrong. What if I fail to call rclone frequently enough? I guess my authorization token will expire, and I’ll have to re-authorize manually.
  • If I use a cron job that runs every minute, there’s a chance one rclone could still be busy while a second one gets launched. Does rclone in some way notice and handle multiple instances running concurrently? Could two instances interfere with each other and cause problems, such as both trying to update the authorization token at the same time, or competing for some other lock file or resource?

box grants a refresh token which can be used once to refresh the token, so everything should carry on wrking.

If you use the latest beta then this exact problem was addressed recently!

Great, thank you for the replies! Given that we’re currently using the version of rclone packaged by redhat, it sounds like a good approach for us would be to use a wrapper script (I plan to use python), that uses a lock file to prevent multiple entry, and runs an infinite loop.

Thanks again!

1 Like