I will be invoking rclone from a cron job that starts up on a repeating schedule to sync content that changes on a random basis. The run time will vary from a few minutes if there's nothing to do, to many hours for large amounts of data, possibly running past the next scheduled invocation time. I want to prevent another instance from running if the previous instance is still in progress. I know I can write a script to do this, but I was wondering if rclone has any clean built-in way of achieving this?
Run the command 'rclone version' and share the full output of the command.
If you want a cheap way of preventing multiple rclone's running use the --rc flag. Only one rclone can listen at a port at once. You can set --rc-addr localhost:9999 also to change the port number if you want groups of rclone's that run at once.
Okay, that should definitely be accompanied by comments in the crontab explaining what's going on, but it does sort of achieve the desired goal rather nicely. I did expect any "elegant" solution to require a unique identifier of some kind so that conflicting instances could "agree" that they were performing the same task and were thus in conflict, and the port number meets that need quite well. You wouldn't want to prevent other non-conflicting rclone instances from running... Thanks!