Terminal Scripts - Bytesized Hosting Wiki
For those days when everything downloads and you get API blocked by Google....
It happens!
if you think you may have days when you need to upload more than 750GB a day - the following works:
- Use a Team Drive rather than a normal Google Drive. This gives other accounts you share it with full access without sharing your upload or API limits.
- Create multiple normal Google accounts (no need for paid accounts)
- Share your Team drive with these accounts. It can take a couple of minutes to appear in the other Drives.
- Using Rclone config, create multiple drives, one per account. Make sure you set them up as team drives when the option appears.
Once the above is done, use the following script to upload your downloaded files. A mount will not work! I have this set up to run hourly using crontab - feel free to use whatever schedule you'd like. Bear in mind though that having two versions running at the same time could cause issues!
My Drives are named
- GDrive-Team
- GDrive-Team1
- GDrive-Team2
- GDrive-Team3
Feel free to call them whatever you want but obviously edit the code! Also - you can have as many / as few as you'd like. Also remember to edit the source and destination folders to match your folder structure.
You'll notice the last sync is different - this is to handle a secondary video download script I manually run which does not like files disappearing mid transfer. This will look for .part files and if present will skip transferring that folder to next time. You probably don't need this!!
#!/bin/sh
lastsync=$(tail -1 lastsync.txt | head -1)
if [ $lastsync = "Team" ]; then
teamnumber=""
echo "Team1" > lastsync.txt
elif [ $lastsync = "Team1" ]; then
teamnumber="1"
echo "Team2" > lastsync.txt
elif [ $lastsync = "Team2" ]; then
teamnumber="2"
echo "Team3" > lastsync.txt
elif [ $lastsync = "Team3" ]; then
teamnumber="3"
echo "Team" > lastsync.txt
fi
echo "Using Team Account $lastsync to save to Drive"
driveToUse=GDrive-Team$teamnumber
SRCpath=/home/hd3/adskii/ToMove
echo $driveToUse
seriesSRC="$SRCpath/Unorganised Series"
filmsSRC="$SRCpath/Unorganised Films"
musicSRC="$SRCpath/Unorganised Music"
appsSRC="$SRCpath/Downloaded Apps"
booksSRC="$SRCpath/E-Books"
dlvideoSRC="$SRCpath/Videos-To-Move"
seriesDST="$driveToUse:Unorganised Series"
filmsDST="$driveToUse:Unorganised Films"
musicDST="$driveToUse:Unorganised Music"
appsDST="$driveToUse:Downloaded Apps"
booksDST="$driveToUse:Unorganised Books"
dlvideoDST="$driveToUse:Plex Cloud Videos"
/usr/local/bin/rclone --exclude /hold --retries 50 move -v "$seriesSRC" "$seriesDST"
/usr/local/bin/rclone --exclude /hold --retries 50 move -v "$filmsSRC" "$filmsSRC"
/usr/local/bin/rclone --exclude /hold --retries 50 move -v "$musicSRC" "$musicDST"
/usr/local/bin/rclone --exclude /hold --retries 50 move -v "$appsSRC" "$appsDST"
/usr/local/bin/rclone --exclude /hold --retries 50 move -v "$booksSRC" "$booksDST"
count=`ls /home/hd3/adskii/ToMove/Videos-To-Move/*.part | wc -l`
echo '.Part files existing ' $count
if [ $count -lt 1 ]
then
echo 'Video Sync Running'
/usr/local/bin/rclone --exclude /hold --retries 50 move -v "$dlvideoSRC" "$dlvideoDST"
fi
Last Author | Contributors | Versions | Last update |
---|---|---|---|
adskii | None | 3 | Tue, 09 Mar 2021 18:19:20 +0100 |