I have a few different projects that are being ran on Raspberry Pi's that generated data daily that I wanted to backup to an Offsite solution. I have an onsite [cloud] solution but wanted to see if I could upload to a cloud solution such as Google Drive via command line.
There are several prebuilt solutions that already exist. I came across gDrive that was as simple as copying a token from your browser to the application and utilizing it. The GitHub page can be found here. https://github.com/gdrive-org/gdrive
wget https://github.com/gdrive-org/gdrive/releases/download/2.1.0/gdrive-linux-rpi
chmod +x gdrive-linux-rpi
sudo install gdrive-linux-rpi /usr/local/bin/gdrive
This will involve a machine with a browser. When you run the command gdrive list it will give you a URL to visit. Enter that url into a browser and authorize the app and paste the token that Google provides back into the command line.
gdrive upload blog.tar.gz
gdrive upload file will upload the file to the authorized Google drive account. Once you have gdrive installed you will be able to setup a cron job that will upload the file(s) on a schedule to Google Drive.
Do note that depending on the data and other aspects in your environment, you may need to do some additional encrypting before uploading to Google Drive. GDrive does not provide an option of encrypting before uploading. There are other tools that will encrypt and upload for you or you can set the file(s) to be encrypted via a utility in the cron script.