Config files to make everyday life easier...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

backup.sh 937B

12345678910111213141516171819202122232425262728293031323334353637
  1. function backup {
  2. case "${1^^}" in
  3. "WORK")
  4. CONFIG_FILE="$HOME/.config/rsync/work.conf"
  5. DEST="/run/media/carlos/Transposon/TempStoragei"
  6. PROFILE="work"
  7. ;;
  8. "HOME")
  9. CONFIG_FILE="$HOME/.config/rsync/home.conf"
  10. DEST="/run/media/carlos/Elements/Work/College"
  11. PROFILE="home"
  12. ;;
  13. "CLONE")
  14. CONFIG_FILE="$HOME/.config/rsync/home.conf"
  15. DEST="/run/media/carlos/Canvio/Work/College"
  16. PROFILE="home"
  17. ;;
  18. *)
  19. printf "%s\n" "The profile doesn't exist. Available profiles are: \`home', \`work', and \`clone' (work)."
  20. return 1
  21. ;;
  22. esac
  23. if [ -n $PROFILE ]; then
  24. # RSYNC options
  25. RSYNC_ARGS="--recursive --links --perms --executability --times --group --owner --human-readable --info=progress2"
  26. # Do backup.
  27. printf "Initialising \e[1m\`${PROFILE}'\e[0m backup...\n\r"
  28. /usr/bin/rsync $RSYNC_ARGS $(cat $CONFIG_FILE) $DEST --delete-after
  29. printf "\nBackup complete.\n"
  30. return 0
  31. fi
  32. }