If you are an avid seedbox user, here is another option for automatic uploads to google drive.
There are many ways of achieving this, including a cronjob.
I like this option, as it only runs rclone when a torrent completes.
Using inotifywait to watch for file system events, we look out for primarily the ‘move’ event.
When your torrent completes, it moves the completed torrent into the completed folder.
When this event takes place, when then execute rcopy.sh
Setup rclone and scripts
1 2 3 4 5 6 7 | mkdir ~/bin cd ~/bin wget https://downloads.rclone.org/rclone-v1.38-linux-amd64.zip unzup rclone-v1.38-linux-amd64.zip mv rclone*/* . |
rscreen.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/bin/bash -x ScSess=$(screen -ls) if [[ $ScSess == *"No Sockets found"* ]]; then killall -9 rclone rm -rf ~/bin/rcopy.sh.lock screen -dmS rwait ~/bin/rwait.sh else exit fi |
rwait.sh
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash -x COMPLETED_TORRENTS=~/private/deluge/completed/ while true; do inotifywait -r -e modify,attrib,move,close_write,create,delete,delete_self $COMPLETED_TORRENTS ~/bin/rcopy.sh done |
rcopy.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/bash -x #!/bin/bash -x COMPLETED_TORRENTS=~/private/deluge/completed/ if [ -f "~/bin/rcopy.sh.lock" ]; then exit else touch ~/bin/rcopy.sh.lock ~/bin/rclone --config=~/.config/rclone/rclone.conf --verbose --transfers=8 copy "$COMPLETED_TORRENTS" "google:/unsorted/" rm -f ~/bin/rcopy.sh.lock fi |
Permissions and PATH
Once you have setup the 3 scripts, make them executable
Permissions
1 2 3 | chmod +x ~/bin/* |
If ~/bin is not in your path, then add it and reload your shell
Edit Path
1 2 3 4 | echo "PATH=~/bin:\$PATH" >> ~/.bashrc source ~/.bashrc |
Finally you run the main script in a cronjob
Finalize and run in the background
Screen session
1 2 3 | */1 * * * * /media/sdf1/feeditout/bin/rscreen.sh >/dev/null 2>&1 |
You can read more about inotifywait and rclone here
https://linux.die.net/man/1/inotifywait
https://rclone.org/