Google Drive Cron Backup is a Python program for syncing data between two hosted databases, regardless of provider.
- Universal: This project is built on rclone, which allows for universal file transfer between many data providers (Google, Box, etc...) See this full list of compatible platforms.
- Portable: Can be used anywhere with minimal external technology setup.
- Worry Free: We support integration with healthchecks.io so you never have to remember to check that the service is working.
This program is built as a simple Python script, intended to be run as a cron job by an external tool.
Every time it runs, it performs the following sequence:
- Use rclone check to see whether the contents of the two drives match.
- If they are already in sync, send a SUCCESS ping to healthchecks.io and exit.
- if they are not in sync, send a FAILURE ping to healthchecks.
- While the drives are out of sync, send a START ping to healthchecks then attempt to sync the contents of the two drives. if it fails, it will try again, otherwise, it will send a SUCCESS ping to healthchecks.io and exit.
Healthchecks will inform you by email or using whatever contact method you set up if it does not receive confirmation within a designated period that the drives are in sync.
It is recommended to run this on a Linux server instance, but any computer with Python installed and a cron system that can be relied upon to stay on will do the trick.
- Clone this repository on your machine.
- Install rclone on your machine. A guide can be found here.
- Set up the two drives for the sync using rclone config command.
- Create a Check on healthchecks.io. Signup may be necessary
- Edit script.py with the appropriate drive directories from rclone and check hash in lines 4-6.
- Set up a cron job to run as often as you like.
- Example using crontab and flock:
*/5 * * * * flock -n /tmp/google_drive_sync.lock </path/to/python3> /path/to/google-drive-cron-backup/script.py
Documentation is extremely limited for this project. It consists basically of the info contained in this file. You can improve it by sending pull requests to this repository.
- Sync local NAS to remote archive If one maintains a Network Attached Storage device, one could use this service to automatically back up stored data to Google Drive.
- Many to one: If one has two data sources, each with different access rules and purposes, but wants to be able to view both in the same store, this service could be used to copy data from each source into multiple folders in one destination source.
I appreciate your interest in improving this project.
I am no longer actively working on this project. However, if you have any ideas for improvements to make the repository more robust or easier to use, feel free to open a pull request.
Please keep PRs streamlined and minimal and avoid making breaking changes wherever practical.
New to GitHub? Read this Contributing Guide as a jumping-off point.
Feel free to submit an issue here.
Maintaining this project is not a high priority for me, but I will try to address any issues as they come up.
This repository exists for the benefit of myself and future developers. Please be respectful.
Google Drive Cron Backup is MIT licensed.