Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Synchronize with Google Drive
This howto was reported by one of the users via this issue https://github.com/ccrisan/motioneyeos/issues/4. 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 wget https://github.com/odeke-em/drive/releases/download/v0.2.2-arm-binary/drive-arm-binary # 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 sync.sh script wget https://gist.githubusercontent.com/Limeliz/4389cc40744331736c59/raw/bee4809bcf3a8eef01a9d8394d996eaf4d8ae1ec/sync.sh # make the script executable chmod +x sync.sh # 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:
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/sync.sh >> /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.