Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    [Tutorial] How to sync saves/roms to the cloud

    Your discoveries
    [tutorial] sync savesroms cloud
    4
    8
    5260
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MinZe
      MinZe last edited by

      Hello, I've managed to run rclone to have synced any folder on almost any cloud.
      The clouds available are all those listed here: https://rclone.org/

      Step 1: Download the necessary files.

      open ssh and run those commands:

      cd ~
      mkdir -p rpi-sync    
      wget -O rclone-install.sh https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh   
      wget -O rclone-sync.sh https://raw.github.com/pageauc/rclone4pi/master/rclone-sync.sh   
      wget -O rpi-sync/Readme.md https://raw.github.com/pageauc/rclone4pi/master/Readme.md
      

      now we have all the necessary files, but we have to modify rclone-install.sh
      run: nano ./rclone-install.sh
      Delete all the sudo on the file, at the end you should have something like that:
      0_1524321467750_Screenshot from 2018-04-21 16-33-36.png
      now let's finish with the commands

      chmod +x rclone-install.sh
      chmod +x rclone-sync.sh
      ./rclone-install.sh 
      

      Step 2: Add an account

      Go to https://rclone.org/docs/ and pick any cloud service.
      The steps don't change for Recalbox (at least for Google Drive, which is what I used).

      Step 3: Execute it on start

      Now that we can sync saves, it's time to automate it.
      We have to create a startup script; run:

      cd /etc/init.d/
      nano ./S99Sync
      

      Now we will create the startup script

      #!/bin/bash
      case "$1" in
              start)
      # check that is online to run the first sync command
      while :
      do
              wget -q --spider http://google.com
              if [ $? -eq 0 ]; then
                      # Run the command that will execute only once at the start
                      # this is for GDive, it will copy every folder and file
                      # and it'll delete those that have been deleted
                      /usr/bin/rclone sync gdmedia:rpi /recalbox/share/saves/ &
                      wait $!
                      break
              else
              fi
      done
      # This is the main loop
      while :
      do
              # I prefer to have an external script to run my rclone commands
              /etc/init.d/Copy.sh &
              # the wait will make this script wait until the Copy.sh has finished
              # it's important not to run twice any rclone script at the same time
              wait $!
      done
      ;;
      stop)
      rclone copy /recalbox/share/saves/ gdmedia:rpi
      ;;
      restart|reload)
      rclone copy /recalbox/share/saves/ gdmedia:rpi
      
      ;;
      *)
      esac
      
      exit $?
      

      Exit and save that file.
      Now we will create the Copy.sh file that will have our scripts

      nano ./Copy.sh
      

      This is what I have:

      /usr/bin/rclone copy /recalbox/share/saves/ gdmedia:rpi
      

      This copies the new/modified folders/files from /recalbox/share/saves/ to my google drive folder called rpi
      You can do whatever you want to be executed all the time there.
      Now let's make them executable

      chmod +x Sync
      chmod +x Copy.sh
      

      Perfect! now if you restart your recalbox.... it won't work.
      Even though you can run it from any ssh and it'll work, it won't work itself we have to fix something more

      Step 4: Make it work

      make sure to do this step everytime that you change your rclone configuration.
      You have to copy the rclone.conf from /recalbox/share/system/.config/rclone to /.config/rclone
      I did it manually, but you should be able to do it with this command
      cp -i /recalbox/share/system/.config/rclone/rclone.conf /.config/rclone

      Problems

      1. The startup of any game will be from 1 to 15 seconds slower.

      Special Thanks

      Special thanks to @substring and @voljega for all the help provided to me with this.
      And of course rclone for making this possible, and pageauc for making the rclone4pi

      Sync more things than saves

      I made that to only sync saves, but you are able to sync everything that you want, just change the folder where you want to sync and that you want to sync

      Substring 1 Reply Last reply Reply Quote 3
      • Substring
        Substring @MinZe last edited by

        @minze hey nice tutorial !

        A few things though :

        • you forgot a mount -o remount, rw /
        • i'd make it easier to edit the .sh files by either a sed command or wget the already ready files
        • starting it at S99 could be risky

        Former dev - Please reply with @substring so that i am notified when you answer me
        Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

        acris MinZe 2 Replies Last reply Reply Quote 0
        • cazeysan
          cazeysan last edited by

          Thank you ! 😀

          Viens par là, c'est pareil !

          1 Reply Last reply Reply Quote 1
          • acris
            acris @Substring last edited by

            @substring said in [Tutorial] How to sync saves/roms to the cloud:

            @minze hey nice tutorial !

            • starting it at S99 could be risky

            Why ?

            Substring 1 Reply Last reply Reply Quote 0
            • Substring
              Substring @acris last edited by

              @acris if the "drive" hasn't responded before you launch a rom, it's embarassing

              Former dev - Please reply with @substring so that i am notified when you answer me
              Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

              1 Reply Last reply Reply Quote 0
              • MinZe
                MinZe @Substring last edited by

                @substring It's true I forgot that, is there any way to edit the post? Can't find it though I can for answers.
                And yeah it can be risky, I haven't thought about that

                Substring 1 Reply Last reply Reply Quote 0
                • Substring
                  Substring @MinZe last edited by

                  @minze editing posts is forbidden after a moment to prevent ppl changing their mind. The best would be to write it in the wiki

                  Former dev - Please reply with @substring so that i am notified when you answer me
                  Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                  1 Reply Last reply Reply Quote 0
                  • acris
                    acris last edited by

                    https://github.com/recalbox/recalbox-os/wiki

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post

                    Want to support us ?

                    81
                    Online

                    98.6k
                    Users

                    28.1k
                    Topics

                    187.0k
                    Posts

                    Copyright © 2021 recalbox.com