- This article only discusses the rclone config.
- For the
copymotionscript below it is assumed that the directory from which the Google Drive is configured to serve the files is
/motion. You should adapt the script as appropriate if you configure the Google Drive to share a different directory for motion files.
- We further assume that the
rclone‘remote’ is called
google-drive-motionfor this server.
- For the
ID of the root folderprompt for
rclone configyou may wish to first create a folder (e.g.
motion-root) in Google Drive and use the Folder ID as the ID of the root folder. This will limit rclone’s access to that folder. You would then make
/motion-root/motionshared with whomever you wish to share the motion files (public is an option for this), but the script would still use
google-drive-motion:/motionas the path. See the Google Drive Backend Documentation for Rclone for more details.
Configuring the Pi
To create an new rclone
remote as the
motion user, execute:
sudo -H -u motion rclone config
Google Drive as the backend and answering the prompts appropriately. (Do not configure as a ‘Shared Drive (Team Drive)').
If you are running ‘headless’ (that is without graphical interface and can’t use a browser on the Pi) you will need to follow the instructions for remote authorization, which requires you follow the link provided by rclone on a computer with a browser and to copy the resulting authorization code back into the config prompt on the Pi.
copymotion script for copying to a remote web server directory when using the above autocopy configuration in
Copy this script to
#!/bin/sh ( rclone copy /var/lib/motion/data google-drive-motion:/motion & )
NB This script assumes you have configured the destination for videos and photos to be
/var/lib/motion (which is the default). This is because the rclone config lives in
/var/lib/motion/.config and we do not want to copy it to a public Google Drive folder.