Does anyone have a script to upload to two drives at once?
I’m using a seedbox.
What I was doing was copying the files to a second folder on the seedbox, and then uploading from the original location to one drive, and the second location to a second drive, but that bogged down the seedbox too much.
Now I upload to one, and use a second VPS to copy from one to the other. As my library grows, this is starting to go slower and slower.
A script to upload to two drives would be perfect.
The way the ‘rclone move’ command works is that it completes the copy of the file to the cloud storage provider and then deletes the local copy.
Running 2x “move” commands at the same time would result in one of the remotes having the file, and the other one failing as the local file was deleted before the other process completed.
I would suggest using the “copy” command rather than move if at all possible.
In my opionon this is not a good idea. Cause if the move command finishes before the copy command, your file get’s deleted while the copy command couldn’t finish the upload.
You should try to implement a callback so that you notice when the uploads finished and delete the stuff afterwards. Otherwise you could just run it synchronous.
What I was doing was copying the files to a second folder on the seedbox
Literally copying and not moving? If so, use hardlink instead.
Use a Google Compute instance to do gdrive > gdrive sync. Ingress data is free, so that costs nothing. You get $300 free credit when signing up and you can make lots of accounts. Get a 2core ~3GB ram instance to do regular syncs.
Run all lines in parallel. Output will be concatenated by the lines in order so output will appear that it has run sequentially (that is, unlike using & at the end of each line where output is all sent to the screen as it happens).
parallel < multicopy.txt
Things to remember:
You may need to tweak your rclone parameters so that you’re optimizing your connection. Remember that if you usually get optimal copying via 24 simultaneous copies on a single rclone command (--transfers 24), you’ll want to make each line use a fraction of that (ie, for three simultaneous copies, use --transfers 8). The same would be true for bandwidth limiting parameters and such.
Obviously, make sure each line works on its own. If you haven’t gotten the copy to work yet, test each line separately before trying to run them in parallel.
Parallel will exit when all copies are complete. If you’re doing this as part of another script, the next line in your script will run only after parallel finishes the multi-copy. Thus, something like: