need bit of help with rsync commands


comet424

Recommended Posts

so i been running rysnc  for a while  but i noticed  now when i did --exclude-from 'file name'    and i --delete  it deletes my folder and re rsyncs

 

so my understanding to copy my sisters server to my server  and doesnt delete any files just merely copies over

rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/isos/ /mnt/user/Mitchs\ Files/Backup\ Files/ >> /boot/logs/cronlogs/MitchServer_Backup_Files.log

 

 

then i run every 3 months

rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/isos/ /mnt/user/Mitchs\ Files/Backup\ Files/ --delete >> /boot/logs/cronlogs/MitchServer_Backup_Files.log

 

and from my understanding  it deletes any files on my server that isnt part of my sisters server anymore

 

but i run into a problem when i backup my sisters unraid and i tried to do the exclude file

rsync -avzu --exclude-from '/boot/config/plugins/user.scripts/scripts/exclude1.txt' -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/Backup\ Files/ /mnt/user/Mitchs\ Files/Backup\ Files/ >> /boot/logs/cronlogs/MitchServer_Backup_Files.log

i run that  seems ok

 

when i run 

rsync -avzu --exclude-from '/boot/config/plugins/user.scripts/scripts/exclude1.txt' -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/Backup\ Files/ /mnt/user/Mitchs\ Files/Backup\ Files/ --delete >> /boot/logs/cronlogs/MitchServer_Backup_Files.log

to simulate every 3 months.. it actually deletes  the contents in the folder and re copies it  its not seeing its already there

did i make a mistake?

 

i googled  and some use --exclude-from=     or some go --exclude-from '....'  

with and without = sign  none helped 

and in my txt file is

.Recycle.Bin/
Unraid

 

 

so what i doing is 

i copy my sisters Folders to my Server /Mitchs Files

did i make a mistake all this time  i use the same rsync across all my copying  i 100% dont really know what it all does or means i just use what i was told long ago i should use...  maybe something is wrong

but here is the full script i have to backup my sisters folders.. you will see couple say disabled..  its because i just sliming it down  to 1 rsync to copy 2 or more folders added to install programs folder  instead of doing 2 commands..

so maybe i been doing it wrong all this time  but i cant figure it out why folder gets deleted then re copies the files.. 

when i sit in the folder krusader   it shows its disabled... and when i back out and back in files gone.. but its recreating them

 

its been working like a charm  but when i tried to do  exclude file  thats when i been noticing... but i not 100% sure

 

#!/bin/bash
###################
## Mitchs Server ##
###################
serverip="192.168.0.8"   #(Home)
#serverip="192.168.1.8"  #(Muttis)

# Coping Mitchs Documents To Main Server Tower
#---------------------------------------------
echo "Backing Up Mitchs Documents To Mitchs Folder (Tower) share =============  $(date)" 
echo "Backing Up Mitchs Documents To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  root@$serverip:/mnt/user/Documents/ /mnt/user/Mitchs\ Files/Documents/ --delete >> /boot/logs/cronlogs/MitchServer_Documents.log


#Disabled for now
## Coping Mitchs Install Programs Gamez To Main Server Tower
##-----------------------------------------------------------
#echo "Backing Up Mitchs Games To Games Folder (Tower) share ==================  $(date)"
#echo "Backing Up Mitchs Games To Games Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
#rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/Install\ Programs/Gamez/ /mnt/user/Mitchs\ Files/Install\ Programs/Gamez/ --#delete >> /boot/logs/cronlogs/MitchServer_InstallProgramsGamez.log


#Disabled for now
## Coping Mitchs Install Programs Appz To Main Server Tower
##----------------------------------------------------------
#echo "Backing Up Mitchs Install Program To Mitchs Folder (Tower) share =======  $(date)" 
#echo "Backing Up Mitchs Install Program To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
#rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  root@$serverip:/mnt/user/Install\ Programs/Appz/ /mnt/user/Mitchs\ Files/Install\ Programs/Appz/ --delete #>> /boot/logs/cronlogs/MitchServer_InstallProgramsAppz.log




# Coping Mitchs Install Programs Folder To Main Server Tower
#----------------------------------------------------------
echo "Backing Up Mitchs Install Programs To Mitchs Folder (Tower) share =======  $(date)" 
echo "Backing Up Mitchs Install Programs To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  root@$serverip:/mnt/user/Install\ Programs/ /mnt/user/Mitchs\ Files/Install\ Programs/ --delete >> /boot/logs/cronlogs/MitchServer_InstallPrograms.log

# Coping Mitchs Music To Main Server Tower
#------------------------------------------
echo "Backing Up Mitchs Music To Mitchs Folder (Tower) share =================  $(date)"
echo "Backing Up Mitchs Music To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/Music/ /mnt/user/Mitchs\ Files/Music/ --delete >> /boot/logs/cronlogs/MitchServer_Music.log



# Coping Mitchs Videos To Main Server Tower
#-------------------------------------------
echo "Backing Up Mitchs Videos To Mitchs Folder (Tower) share ================  $(date)"
echo "Backing Up Mitchs Videos To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/My\ Videos/ /mnt/user/Mitchs\ Files/My\ Videos/ --delete >> /boot/logs/cronlogs/MitchServer_Videos.log



# Coping Mitchs Pictures To Main Server Tower
#--------------------------------------------
echo "Backing Up Mitchs Pictures To Mitchs Folder (Tower) share ==============  $(date)"
echo "Backing Up Mitchs Pictures To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/Pictures/ /mnt/user/Mitchs\ Files/Pictures/ --delete >> /boot/logs/cronlogs/MitchServer_Pictures.log

# Coping Mitchs ISOs Files To Main Server Tower
#--------------------------------------------
echo "Backing Up Mitchs ISOs Files To Mitchs Folder (Tower) share ==============  $(date)"
echo "Backing Up Mitchs ISOs Files To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/isos/ /mnt/user/Mitchs\ Files/Backup\ Files/ --delete >> /boot/logs/cronlogs/MitchServer_Backup_Files.log



# Coping Mitchs Backup Files To Main Server Tower
#--------------------------------------------
echo "Backing Up Mitchs Backup Files To Mitchs Folder (Tower) share ==============  $(date)"
echo "Backing Up Mitchs Backup Files To Mitchs Folder (Tower) share =====  $(date)" >> /boot/logs/cronlogs/MitchServer_Summary.log
#rsync -avzu --exclude ".Recycle.Bin/" -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/Backup\ Files/ /mnt/user/Mitchs\ Files/Backup\ Files/ >> /boot/logs/cronlogs/MitchServer_Backup_Files.log
rsync -avzu --exclude-from '/boot/config/plugins/user.scripts/scripts/exclude1.txt' -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"   root@$serverip:/mnt/user/Backup\ Files/ /mnt/user/Mitchs\ Files/Backup\ Files/ --delete >> /boot/logs/cronlogs/MitchServer_Backup_Files.log


echo ""
echo "Completed......"

 

Link to comment

oh and i also do another one with the exclude for my sisters other unraid server  with the exclude file 

i added  Appdata    as i backup her flash but didnt wanna backup the Appdata but its not skipping so im sure i done something wrong

 

and with ssh already copied when  unraid boots up  do i still neeed that ssh stuff in the rsync?  or can that be removed

Edited by comet424
Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.