Steps to Mount Google drive on Centos 6.2
Download the Go distribution:
Click on this link: https://golang.org/dl/
and download this package https://golang.org/dl/go1.4.2.linux-386.tar.gz
Once downloaded then extract under /usr/local/ by running below command:
# tar -C /usr/local –xzf go1.4.2.linux-386.tar.gz
Auto Mounting Google Drive
Install Required RPM's
# yum install git mercurial glibc perl-Error perl-Git nss-softokn-freebl
Now, add “/usr/local/go/bin” to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:
# vi /etc/profile
Use source command to load changes:
# source /etc/profile
Installation of Drive Package:
$ go get -u github.com/odeke-em/drive/cmd/drive
This will download binary under /usr/local/go/bin/.
Once drive is installed on system, before you can use drive, you need to mount your Google Drive directory on your local file system for this make “gdrive” directory and then run “drive init ~/gdrive” command:
$ mkdir gdrive
$ drive init ~/gdrive Visit this URL to get an authorization codehttps://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=354790962074-7rrlnuanmamgg1i4feed12dpuq871bvd.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive Paste the authorization code:
Visit the above URL to get the code and paste the code to get access to Google drive on local system.
Now, run the below command to list the contents of your drive.
# cd /gdrive
# ls –l
Pull and Push Google Drive Content:
# cd /gdrive
# drive pull
The “push” command uploads data to Google Drive to mirror data stored locally.
Like pull, you can run it without any arguments to push all of the files from the current path, or you can pass in one or more paths to push specific files or directories.
Note: To ignore checksum verification during a push use:
$ drive push -ignore-checksum
Add entry in crontab for push and pull to make things automatically instead of manually
# crontab –e
*/1 * * * * /usr/local/go/bin/drive push ~/backup
*/1 * * * * /usr/local/go/bin/drive pull ~/backup
This will pull and push contents every minute.
Check cron logs:
# tail –f /var/log/cron
If user changed the Google drive password even then at linux pc no need to do any changes while uploading and downloading contents.