Synchronize with Google Drive

Calin Crisan edited this page Mar 20, 2017 · 3 revisions

This howto was reported by one of the users via this issue However as most of the Google Drive upload functionality is now built-in, this howto can be considered obsolete.

motionEyeOS is great, but having seen a number of requests for Google Drive functionality, I thought I should share how I got it working.

Here are step-by-step instructions which also work with motionPie:

  • Ensure that you have set a motionEyeOS admin password through the web interface and have rebooted
  • Using SSH, login as root with your admin password from a Mac, Linux or Windows PC
  • Enter and execute the following commands. You can do so one line at a time or just copy and paste the whole block into your SSH session:
# mount the root volume as read/write
mount -o remount,rw /
# change to the /usr/bin directory where we will keep the gdrive executable
cd /usr/bin
# download a pre-built gdrive binary file
# make it executable
chmod +x drive-arm-binary
# rename it to gdrive
mv drive-arm-binary gdrive
# change the root volume back to read-only
mount -o remount,ro /
# create a gdrive directory on the data volume
mkdir /data/gdrive
# change to that directory
cd /data/gdrive
# download Emil Janesten's greatly improved version of Claude Pageau's script 
# make the script executable
chmod +x
# create a symbolic link to the motion output folder
ln -s /data/output output
  • Now you'll want to link gdrive to your Google account. Open a browser on your PC and ensure that you are logged into Google (for example, you could open Gmail).

Back in your SSH session, enter and execute:

gdrive init

This will produce a long, complex URL which you should copy and paste into your PC browser's address line, then press Enter.

You'll need to give permission to manage files in your Google Drive and will then be returned a code to copy back into your SSH session where gdrive is waiting.

A success will return nothing.

  • Finally, you should add a cron entry to copy over files from the motion output folder to Google Drive on a regular schedule.
    # set the crontab editor to be nano (I'm much more comfortable with nano than vi)
      export EDITOR=nano
    # enter crontab editor
      crontab -e
  • Now set the task to run every five minutes by pasting in:

*/5 * * * * /data/gdrive/ >> /data/log/gdrive_output.log 2>&1

Then quit nano with control-x and save the crontab entry.

That's it. You can have it up and running in about five minutes and it seems to work without any unforeseen problems.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.