Skip to content

Instantly share code, notes, and snippets.

@ryanoverhauser
Created September 26, 2024 06:32
Show Gist options
  • Save ryanoverhauser/8b514a21182c149fe3493fadd059d57f to your computer and use it in GitHub Desktop.
Save ryanoverhauser/8b514a21182c149fe3493fadd059d57f to your computer and use it in GitHub Desktop.
A simple script to sync put.io using rclone
#!/bin/bash
### Add to crontab to run this script every 5 minutes:
### */5 * * * * /home/ryan/Desktop/putio_sync.sh
### Logfile location
logfile=/home/ryan/Desktop/putio_sync.log
echo "$(date '+%Y/%m/%d %T') INFO : Starting sync" >> $logfile
### Check if an rclone sync process is already running and bail if true:
number=$(ps aux | grep -v grep | grep -ci rclone)
if [ $number -gt 0 ]
then
echo "$(date '+%Y/%m/%d %T') INFO : An rclone sync is already in progress: Aborting" >> $logfile
exit 1
fi
### Sync Put.io root directory, excluding the /Seeding directory:
/usr/bin/rclone sync putio:/ /home/ryan/Desktop/media/putio \
--exclude /Seeding/** \
--auto-confirm \
--transfers 2 \
--log-file $logfile \
-v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment