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 778B

12345678910111213141516171819202122232425262728293031
  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. *)
  14. printf "%s\n" "The profile doesn't exist. Available profiles are: \`home', and \`work'."
  15. ;;
  16. esac
  17. if [ -n $PROFILE ]; then
  18. # RSYNC options
  19. RSYNC_ARGS="--recursive --links --perms --executability --times --group --owner --human-readable --info=progress2"
  20. # Do backup.
  21. printf "Initialising \e[1m\`${PROFILE}'\e[0m backup...\n\r"
  22. /usr/bin/rsync $RSYNC_ARGS $(cat $CONFIG_FILE) $DEST --delete-after
  23. printf "\nBackup complete.\n"
  24. return 0
  25. fi
  26. }