Requirements:
Advantages and Disadvantages of VestaCP as a Free Web Hosting PanelVesta CP vs ISPmanager: Which Web Control Panel is Better?
So for this purpose, we are going to use google-drive-ocamlfuse. It is a FUSE file system for Google Drive, written in OCaml. It lets you mount your Google Drive on Linux.
Step 1: Install google-drive-ocamlfuse
Install google-drive-ocamlfuse on your Linux server with VestaCP Installed. With this program, we will connect Google Drive to our server and will be able to manage files directly from Linux CLI.
Step 2: Once you have successfully installed google-drive-ocamlfuse on your server the next step is to authorize and access your Google Drive Account.
Step 3: Automate Google Drive Transfer
In this step, we will automate the transfer of backup archive to Google drive by scheduling cron tasks.
- First, create a folder inside /google_dir folder named backups, this will be used as temporary storage until the transfer process completes. sudo mkdir /google_dir/backup/
- Enter the below command (a choice of text editors may appear, I advise you to choose nano or vim which you have installed):
- Add the following line to the end of the cron file: Now you can configure the archive transfer schedule by modifying the above line with your cron execution time. For example in my scenario at 2:44, by server time, on behalf of the administrator, files matching the * .tar mask will be copied to the “google_dir/backup/” folder, files that are already found in the target folder will not be copied. If you have many users, and you need only one backup, then it would be wise to change the file mask to admin *.tar. Now make sure that VestaCP backups are turned on as this will only use those backups created by VestaCP in backups and will transfer them in your Google Drive folder as per your cron schedule. Note: You can also paste the above command in cron settings provided by VestaCP.
Step 3: Deleting Old Backup Archives
In this process, you can configure on how much backup cycle or for days your backup will retain on Google drive and after that, it will automatically delete older archives. 2. Make the file executable. 3. Schedule the automatic execution. Add the below code inside the file that you created. The above command will be executed at 2:10 on server time, on behalf of the administrator, the files in the folder “/google_dir/backup/” matching the mask “* tar” will be deleted leaving the 7 of the most recent ones untouched. That’s all, the above steps will automate your Backups to Google Drive. If you face any problem following the steps or need any help just leave your queries in the comments below.