Monday, April 21, 2025

automating backup with python - rclone and google drive

There was a python script written to
1. Compress the audio files that are created from the previous backup date to now into a folder and zip it 
2. Export the zip file to Gdrive.
2. Extract the mysql backup into a .sql file, export that also into the gdrive folder.
3. delete the past backups. 

For this, rclone and zip needed to be installed. After that, I passed on abbreviated instructions for setting up an rclone remote for GDrive - 

You will need to use the method "(N) running rclone on a machine without web browser" from the instructions onscreen, which are also shown at

As mentioned here, 
you need to download the latest rclone and install on your local system (where you have access to a web browser, where you can log on to google and give permission for rclone etc when prompted), and follow the onscreen instructions to set up rclone config for your desired google drive login.

After they set up the script, remote etc and found them working, set up a daily cron for 12:15 midnight,
15 0 * * Sun /usr/bin/python3 /home/path-to/backup_service.py 
which the user can edit from their login using
crontab -e

No comments:

Post a Comment