Homepage › Forums › RetroPie Project › Everything else related to the RetroPie Project › Automate Nightly Backups of your RetroPie Saves by Syncing to Google Drive
- This topic has 0 replies, 1 voice, and was last updated 9 years, 11 months ago by laoracc.
-
AuthorPosts
-
12/20/2014 at 23:30 #83837laoraccParticipant
Per the title, here’s how to automate a nightly backup of your SNES/Megadrive/GBA saves (these are the only ones I’ve tested), by syncing with a google drive account.
(Here’s the Reddit Post, which is a bit nicer to read)
What you’ll need:
A compiled grive executable. For those who don’t want to compile their own, here’s a link to an already compiled version.
A script to traverse your ./roms/ directory for save files. Here’s a link to the python v2.7 script
A cronjob. More details on this below.
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 thensudo 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 folderConfirm it was successful by going to google drive and checking to make sure the files are there.
More info:
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.
-
AuthorPosts
- The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.