Last active
July 13, 2020 16:54
-
-
Save brettpetch/befe1a33ce4c3f4dbb11d2430b789ca5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# RCLONE UPLOAD CRON TAB SCRIPT | |
# chmod a+x /media/sdan/ynbldgno/cron/rclone-upload.sh | |
# Type crontab -e and add line below (without #) and with correct path to the script | |
# * * * * * /media/sdan/ynbldgno/cron/rclone-upload.sh >/dev/null 2>&1 | |
# if you use custom config path add line bellow in line 20 after --log-file=$LOGFILE | |
# --config=/path/rclone.conf (config file location) | |
# Feral config location: /media/sdan/your-username-here/.config/rclone/rclone.conf | |
if pidof -o %PPID -x "$0"; then | |
exit 1 | |
fi | |
CONFIGFILE="/path/to/rclone/.config/rclone/rclone.conf" | |
LOGFILE="/path/rclone-upload.log" | |
FROM="/path/Downloads/" | |
TO="hawke-user:/user-Media/" | |
# CHECK FOR FILES IN FROM FOLDER THAT ARE OLDER THAN 15 MINUTES | |
if find $FROM* -type f -mmin +15 | read | |
then | |
start=$(date +'%s') | |
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD STARTED" | tee -a $LOGFILE | |
# MOVE FILES OLDER THAN 15 MINUTES | |
/user/bin/rclone move "$FROM" "$TO" --transfers=20 --checkers=20 --delete-after --min-age 15m --log-file=$LOGFILE --config=$CONFIGFILE | |
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD FINISHED IN $(($(date +'%s') - $start)) SECONDS" | tee -a $LOGFILE | |
fi | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment