+3 votes
199 views
Syncing Google Drive with Linux

in Linux / Unix by (551k points)
reopened | 199 views

1 Answer

+4 votes
Best answer

We are becoming quite dependent users of the files in a cloud for the simple reason of having the files available wherever there is internet access.
One of the best services to achieve this is Google Drive , while the integration with the android devices is excellent, there is no official Linux client to synchronize with the cloud service. While we can edit documents from a browser we can not synchronize from our desktop.

Getting Grive

We will use Grive , a Google drive tool by command line that helps us achieve the purposes of our synchronization. First we download the git repository with:

 $ git clone git: //github.com/Grive/grive.git 

Once downloaded we go to the new directory created.

image


Grive Bookstore

Before compiling Grive , we must make sure that the libraries that Grive needs are installed in our system, which are the following:
• libgcrypt11-dev
• libjson0-dev
• libcurl4-openssl-dev
• libexpat1-dev
• libboost-filesystem-dev
• libboost-program-options-dev
• binutils-dev
We verify and those that we do not have, we install them before proceeding.

Building Grive

To configure the Grive construction environment, we wrote the following in the terminal:
 $ cmake. 

Compiling Grive

It's time to compile Grive and we do it with the following command:
 $ make 
This will take a while while compiling the packages.

Move the executable

In order for the downloaded files not to be synchronized with the Git files, we must move the Grive executable to some other directory which we will use as a directory to synchronize.

First synchronization

We move to our Google Drive directory and execute Grive for the first time in the following way:
 $ ./grive -a 
This will make an initial configuration and give us a link. We can click on it or copy it and paste it in the address bar of a browser.



image


Permissions for Grive

We make sure that we are logged into our Google account before going to the address provided in the previous step and then we give Grive permission to access Drive. Copy the code that will give us and paste it into the terminal, continue with the first synchronization.

For future synchronizations we just have to open a terminal and run Grive from the Google Drive directory that we created with:

 $ ./grive 

At the moment to synchronize files we must perform the step described above.



image


Crontab cn synchronization

To make the synchronization automatic we use a cron and a crontab to set a scheduled task. To open the crontab we write the following:
 $ crontab -e 
If it is our first time with crontab , we should only have a text editor to use it additionally the syntax to create a scheduled task is as follows:
Minute, Hour, Date, Month, Day command

Scheduled Task

In this example we want Grive to synchronize every 10 minutes and for that we write the following:
 * / 10 * * * * * cd / home / user / GoogleDrive / & & grive 

Once we have finished with the scheduled task, we make sure to save our crontab with Ctrl + O , then Ctrl + X to exit.

With this procedure we will not have an application or an interface for the synchronization of documents in Linux but at least we will have our directory destined to synchronize all the files that we need thanks to Grive.

by (3.5m points)
edited

Related questions

+3 votes
1 answer
+3 votes
1 answer
asked Sep 19, 2019 in Linux / Unix by backtothefuture (551k points) | 271 views
+5 votes
1 answer
+3 votes
1 answer
+4 votes
1 answer
asked Nov 14, 2019 in Internet by backtothefuture (551k points) | 256 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users