This is a simple script that runs rclone to backup a folder to Google Drive. The script supports versioning of backups. Files updated or deleted are stored in a separate backup directory with timestamp for archiving.
I posted a blog on how this script was developed and some explanations on the rclone commands. You can read the blog here.
- Download the files
backup.shwhich is a bash script that runs rclone sync and therclone-ignore.txtwhich is a list of exclude files that will be ignored in the backup. - Update
backup.shto add folders to backup. - Update
rclone-ignore.txtto add or remove files or path to be ignored. - Place both files in a folder of your choice.
- Enable execute permission on the script.
chmod u+x backup.sh
- Schedule the script on crontab.
e.g. to run every 6am and 6pm daily
0 6,18 * * * /your-install-path/backup.sh
- An
outfolder will be created in the install path that contains the logs files.
The log files in the out folder will eventually grow. The backup folder containing the deleted/updated files in Google Drive will also grow over time. For now, the script does not support cleaning them automatically, delete these files regularly.