Skip to content

Instantly share code, notes, and snippets.

@MorphyDK
Last active August 17, 2022 12:23
Show Gist options
  • Save MorphyDK/2b2ade81d20b6c4ad8cc1efc5eb9407a to your computer and use it in GitHub Desktop.
Save MorphyDK/2b2ade81d20b6c4ad8cc1efc5eb9407a to your computer and use it in GitHub Desktop.
Rclone upload script
#!/bin/bash
# RCLONE UPLOAD CRON TAB SCRIPT
# Type crontab -e and add line below (without #)
# * * * * * /home/plex/scripts/rclone-upload.cron >/dev/null 2>&1
# modify line 20 config file location
if pidof -o %PPID -x "rclone-upload.sh"; then
exit 1
fi
LOGFILE="/home/plex/logs/rclone-upload.log"
FROM="/home/plex/move"
TO="Googlecrypt:/"
# CHECK FOR FILES IN FROM FOLDER THAT ARE OLDER THAN 15 MINUTES
if find $FROM* -type f -mmin +15 | read
then
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD STARTED" | tee -a $LOGFILE
# MOVE FILES OLDER THAN 15 MINUTES
/usr/bin/rclone move -v --config=/home/plex/.config/rclone/rclone.conf $FROM $TO --transfers=5 --checkers=5 --delete-empty-src-dirs --log-file=$LOGFILE
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD ENDED" | tee -a $LOGFILE
fi
exit
@MorphyDK
Copy link
Author

MorphyDK commented Oct 2, 2019

Rclone upload script for Gdrive.
If you want to use mergerfs - my setup adds an extra folder to /home/plex/move , so replace media folder with move .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment