How to backup VestaCP files to Google Drive automatically Centos 6,7

Recently, I got an issue with my website backups so I moved my website Into a fresh VPS with VestaCP and started researching how to upload VestaCP backups to my cloud drives to keep them safe and I found a solution to backup vestacp files to Google drive automatically.

Currently im running VestaCP in Centos 6 but this tutorial may work in all Centos Versions.

How to backup VestaCP files to Google Drive automatically

Install Gdrive

We have to install a third-party CLI tool which lets you simply transfer files to your Google Drive with scripts.

This is a tool to upload files using OAuth2, this does not sync.

Now type drive

It will ask for verification code like this :

Now we have created link between our server and Google Drive. Now we can upload our files to Google drive.

Backup Script

Now create a file tech4bros.sh with the following code in /home/backup/ directory

Now Add it on Corn Job to run it automatically
echo "0 2 * * * root /home/backup/tech4bros.sh >> /etc/crontab

Now the cornjob runs it daily on 2AM.

If you have modifications or problem in using it, share it on the common section below.