Advertisement
MrTechie

RSYNC Backup made easy on Linux

Jan 3rd, 2020
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.33 KB | None | 0 0
  1. DIR_Destination="/Your/External/DiskDrive/BackupLocation" # Once in the folder in Linux press Ctrl+L and you should be able to see the folder path in your Linux File Manager.
  2.  
  3. params=(
  4.     -avh
  5.     --stats
  6.     --exclude='#recycle'
  7.     --exclude='@eaDir'
  8.     --no-perms --no-owner --no-group
  9.     --exclude='Resources/Images'
  10.     --exclude='*.gz.*'
  11.     --exclude='*.mrimg'
  12.     --exclude='*.ova'
  13.     --exclude='$RECYCLE.BIN'
  14.     --exclude='*.Spotlight-*'
  15.     --exclude='*.wim'
  16.     --exclude='*.dmg'
  17.     --exclude='*.app'
  18.     --delete-before
  19.     --chmod=ugo=rwX #You only need this if you specifically want to copy files without their source's permissions.
  20.  
  21.  
  22. DIR_Source=root@172.16.1.251:/volume1/FolderName #The host using IP or Hostname and then the folder that has your folders in it you need backed up.
  23. DIR_Destination=/media/mnt/device/sda1/Folder/ #The folder that your saving the source into.
  24. DATESTAMP=$(date +%Y%m%d%H%M%S) #The Timestamp you would like for hte Log File.
  25. LOGFileLoc=/media/mnt/device/sda1/Logs/FOlderName/${DATESTAMP}.DescriptiveName-backup-log.txt
  26.  
  27. rsync --log-file=$LOGFileLoc $DIR_Source $DIR_Destination "${params[@]}"
  28.  
  29. #If you have more data to backup - Simply copy lines 22 - 27 and paste below for as many top-level folders as needed.
  30. #
  31. # Refer to this video for a demo: https://youtu.be/wQF9hLjx5K4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement