Getting Google Drive on Ubuntu

So, when Google released Drive, I was so excited.  It was half the cost of Dropbox with double the space.  Awesome.  But, no full support for Linux.  Well crap.  Because of that, I’m still holding on to Dropbox for now for the items I sync most frequently.  However, there are files that I do not update as frequent and thus am using Google Drive to store them.  So, whats a Linux user to do?

Grive comes to the rescue.  Grive is an open source Linux client for Google Drive.  It work perfectly for me.  The only problem is that it does not keep files synced automatically (ie it doesn’t run in the background) so you have to run the  application manually in order for the files to sync.  That’s where I’ve created a little script that runs every 2 minutes via a cron job to do it for me.

Of course, you’ll need to make sure you have Grive installed and configured.  Use this tutorial on how to do that: [ “$ (pidof grive)” ]

Now, we’ll create the script to handle an automatic sync for us.

sudo pico /usr/local/bin/syncgrive.sh

Add the following contents then ctrl O then enter to save

#!/bin/sh

if [ “$ (pidof grive)” ]
then
echo “Grive is already running.”
else
cd /home/myuser/Drive
grive
fi
exit

Change /home/myuser/Drive to the Drive folder you configured.

Now edit your cronjobs:

crontab -e

Then add the job (ctrl O then enter to save):

*/2 * * * * /usr/local/bin/syncgrive > /dev/null 2>&1

That will run every 2 minutes.  Adjust to your preferences.

There ya go! An [ “$ (pidof grive)” ] for Google Drive.