Scripts to automate rclone commands
rclone is a useful tool to sync files on your local machine to and from the cloud. These scripts are created for the purposes of making rclone easier to use.
- A basic understanding & usage of rclone.
- Create an
.env
file with the following environment variables:
-
RCLONE_SOURCE_PATH
- The path on your local machine that contains all directories to be synced with your cloud service provider. -
RCLONE_DEST_PATH
- The path on your cloud service provider that contains all directories to be synced with your local machine. -
IGNORE_DIRS
(optional) - A comma separated string of directory paths fromRCLONE_SOURCE_PATH
to skip. These won't be synced. e.g.IGNORE_DIRS="ignore1,ignore2,ignore3"
Will sync files from your local machine to your selected cloud provider.
This utility really shines as a way to automate backups. This can be done by setting up a cron job with a file output for logging. For example, this is a cron job that will run this script every day at 3am:
0 3 * * * /path/to/your/sync.sh >> /path/to/your/logfile.log 2>&1
Make sure to copy over the .env
to your $HOME
directory before starting the cron job or else it won't work.