A Google account (I made a new one) for the Google storage.
The step by step:
Create a new directory in /home/pi/ and call it google_backup (this is important for the python script to function correctly). Place the grive executable here.
cd ./google_backup, and run grive: ./grive -a . Visit the URL that comes up, then post the auth code given (you must have been logged into Google). You should get some messages including “Synchronizing files” … now you are running. Important: Don’t do this with an already existing google drive account unless you have the free space on your Raspberry Pi.
EDIT: For grive to run, you need Boost 1.49 and the yajl library, so make sure to run these first: sudo apt-get update, and then sudo apt-get -y install libboost-dev libyajl-dev
Place the python script into the /home/pi/Retropie/roms/ directory
Setup a cronjob: crontab -e . Youll want to place the text in the downloaded crontab file here. The bottom two lines are the most important. Ctrl+O to save changes, Ctrl+X to exit.
Note: The crontab above will now run the python script at 3am on a daily basis, followed by the grive sync 10 minutes after.
I suggest trying this manually before the cron job, as I’ve only tried this on my RPi (which works), and count vouch for this working on every setup. To do so:
First run the python script -> python saveBackup.py .
Then run ./grive in your google_backup folder
Confirm it was successful by going to google drive and checking to make sure the files are there.
Grive is a git repository that will sync the folder it’s located in with a google drive account. Running ./grive -a only needs to be done the first time, then ./grive for all subsequent occurrences. Grive appears to be smart enough to sync any existing files again, so long as they have been changed since the last sync. Take into consideration that Grive will pull any existing contents of your google drive account to your RaspberryPi. As such, I recommend making a new google account for the drive space.
The python script will attempt to create all of the rom directories in your google_backup folder if they dont already exist. It’ll then traverse the rom directories for .sav/.state/.srm files and copy them into the respective directory in ./google_backup. If anyone knows of other save files it should look for, let me know and I’ll update it.