Skip to content

engacs/Autobackup-databse-to-GoogleDrive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autobackup databse to GoogleDrive

Some settings
Firstly, we'll need to setup some variables for use throughout.

 // User home directory (absolute)
  $homedir = "backup/"; // If this doesn't work, you can provide the full path yourself
 // Site directory (relative)
  $sitedir = ""; 
 // Base filename for backup file
 $fprefix = "sitebackup-";
 // Base filename for database file
 $dprefix = "dbbackup-";
 // MySQL username
 $dbuser = "";
 // MySQL password
 $dbpass = "";
 // MySQL database
 $dbname = "";
 // MySQL Host
 $host = "";
 // Set the parent folder. Google Drive 
 $parentId = "";

// Google Drive Client ID
  $clientId = ""; // Get this from the Google APIs Console https://code.google.com/apis/console/
 // Google Drive Client Secret
  $clientSecret = ""; // Get this from the Google APIs Console https://code.google.com/apis/console/
  // Google Drive authentication code
  $authCode = ""; // Needs to be set using getauthcode.php first!    
  // Request URI 
  $requestURI = "urn:ietf:wg:oauth:2.0:oob";

Automating the process
Once everything is in place, you are authenticated and everything is working a simple crontab item should be enough to get things on the go.

5 0 * * 6 /usr/local/bin/php /home/myusername/backuptogoogledrive.php

Or you can use cron-job.org.


Copyright (C) 2019 EngAcs http://www.engacs.pw

About

automatically backup mysql database to Google Drive

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages