1
0

rclone_script-fullsync.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # define colors for output
  3. NORMAL=$(tput sgr0)
  4. RED=$(tput setaf 1)
  5. GREEN=$(tput setaf 2)
  6. YELLOW=$(tput setaf 3)
  7. BLUE=$(tput setaf 4)
  8. UNDERLINE=$(tput smul)
  9. # include settings file
  10. source ~/scripts/rclone_script.ini
  11. getTypeOfRemote ()
  12. {
  13. # list all remotes and their type
  14. remotes=$(rclone listremotes -l)
  15. # get line with RETROPIE remote
  16. retval=$(grep -i "^retropie:" <<< ${remotes})
  17. remoteType="${retval#*:}"
  18. remoteType=$(echo ${remoteType} | xargs)
  19. }
  20. getTypeOfRemote
  21. # header
  22. printf "${UNDERLINE}Full synchronization\n\n"
  23. # Download newer files from remote to local
  24. printf "${NORMAL}Downloading newer files from ${YELLOW}${YELLOW}retropie:${remotebasedir} (${remoteType}) ${NORMAL}to ${YELLOW}~/RetroPie/saves/${NORMAL}...\n"
  25. rclone copy retropie:${remotebasedir}/ ~/RetroPie/saves/ --update --verbose
  26. printf "${GREEN}Done\n"
  27. printf "\n"
  28. # Upload newer files from local to remote
  29. printf "${NORMAL}Uploading newer files from ${YELLOW}~/RetroPie/saves/${NORMAL} to ${YELLOW}${YELLOW}retropie:${remotebasedir} (${remoteType})${NORMAL} ...\n"
  30. rclone copy ~/RetroPie/saves/ retropie:${remotebasedir}/ --update --verbose
  31. printf "${GREEN}Done\n"
  32. printf "\n"
  33. printf "${NORMAL}Returning to EmulationStation in ${YELLOW}10 seconds ${NORMAL}...\n"
  34. read -t 10