Bash String Substitution (rsync Exclude)

I'm preparing a rsync script to backup from one machine to another through ssh. For this I'm successful with the following:

IP=150.163.49.15
ORIGIN=/home
DESTINATION=samba

rsync -avzP --exclude={cristiano,marcelo} root@$IP:$ORIGIN $DESTINATION/

I would like to improve it, moving the exclude part to a variable also. I've unsuccessfully tried this:

IP=150.163.49.15
ORIGIN=/home
DESTINATION=samba
EXCLUDE={cristiano,marcelo}

rsync -avzP --exclude=$EXCLUDE root@$IP:$ORIGIN $DESTINATION/

What is wrong with the EXCLUDE syntax?


Similar Content



Rsync Exclude File List Question

hi experts

I am running a large rsync job, but the exclude list doesn't seem to be working:

The rsync log shows this file as being copied over
/a/test 4.11/Logs/2015-03-03_PID_1234/x.y

but the exclude file clearly includes this line:
/a/test*/Logs/*PID*

So shouldn't it have been excluded?
Thanks

Cygwin Rsync Script Copying File Incorrectly

I am trying to write a simple test script that executes a single rsync call. Once I get the syntax right, the script will be expanded to incorporate several rsync instructions to save me time.

I'm using a Cygwin Terminal on Windows 7 to run Rsync.

The script is called "backup" and I call it from the cygwin terminal using "./backup". Have used chmod to make it executable.

When I execute the rsync instruction as a standalone instruction at terminal prompt, the file copies to the target folder perfectly.

However, when I try and drop the same instruction into a script, it copies the file over from it's original file name "mvi_1840.mov" to a file with the name "." -- literally a single period. I can rename the file to a .mov file and it works fine but naturally, I don't want to have to do this.

The one other thing I will mention is that the file is located in the /home/"username" directory in cygwin vs /bin. But I would not think that this would make a difference.

I have pasted the contents of the script file below:
Code:
#!/bin/bash
    rsync.exe -rltDvP --exclude "System Volume Information" --exclude
 "RECYCLER" --exclude=\$RECYCLE.BIN --delete "/cygdrive/c/users/<USERNAME>
/desktop/mvi_1840.mov" "/cygdrive/c/users/<USERNAME>/desktop/test/"

Any help would be greatly appreciated!

Thanks

Rsync, Reliable "copy And Paste" Type Of Backup In Case Things Break?

What I did in windows was create images of my drive and restore them.

in linux I am running

Code:
rsync -aAXv --exclude={"/home/*","/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* /path/to/backup/folder

and this creates a folder for me with all my files, and apparently saves meta data like permissions and paths...

Since I'm using arch and things break sometimes,I'm booted into a CLI with errors and cannot figure my way out since I'm a noob... would I be able to just delete my entire root and replace it with the rsync backup without a problem?

Rsync Script Problem

Hi all,

I am trying to write a script that syncs files from source to destination. I have one centralized server that can ssh to any servers without pw. Now when I run the script, it can ssh to source server perfectly fine, but you need to enter password for destination server. Was wondering how I can clean this up before I start using case statements

Below is a sample I wrote

#!/bin/bash

#This scripts syncs shit

echo "Type in ID: "
read ID

echo "Type in Server : " #source server
read S

echo "Type in Destination Server: "
read DS

if [ $S == 9 ]; then
ssh -t "root@"$S"webserver1" "rsync -av /home/rlui/"$ID "root@"$DS"webserver2:/home/rlui/";
ssh -t "root@"$S"webserver1" "rsync -av /home/rlui/tmp/"$ID "root@sl"$DS"webserver2:/home/rlui/tmp/"
exit 1

where S and DS are cluster numbers

I apologize in advance if I am not clear on anything

Rsync Cronjob Question

hey guys, sorry for asking a dumb question, but some of the terminology online is not grasping me well, and still leaving me confused


in crontab -e

I have a shell script that contains

rsync /home/willc86 willc86@server02:/home/willc86/backup

the script works good by itself, however i have to put in a password which I understand. i know crontab works, because i used rsync script in the local machine. I am just having problems trying to sync it to another server

how do i get this rsync going in crontab to back it up to another server.

How To Exclude Multiple Types Of File System In Df Output Using -x Flag

Actual #

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-rootvol
25G 6.8G 17G 30% /
/dev/mapper/vg00-tmpvol
4.7G 594M 3.9G 14% /tmp
/dev/mapper/vg00-varvol
9.4G 907M 8.0G 10% /var
/dev/mapper/vg00-auditvol
120M 98M 17M 86% /var/log/audit
/dev/mapper/vg00-crashvol
45G 77M 43G 1% /var/crash
/dev/mapper/vg00-homevol
4.7G 44M 4.4G 1% /home
/dev/mapper/vg02-RhelRepo
9.9G 7.7G 1.7G 83% /var/repo
/dev/cciss/c0d0p1 251M 23M 216M 10% /boot
tmpfs 24G 460M 23G 2% /dev/shm
/dev/mapper/vg01-swap
46G 46G 0 100% /root/swapfile



Required #

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-rootvol
25G 6.8G 17G 30% /
/dev/mapper/vg00-tmpvol
4.7G 594M 3.9G 14% /tmp
/dev/mapper/vg00-varvol
9.4G 907M 8.0G 10% /var
/dev/mapper/vg00-auditvol
120M 98M 17M 86% /var/log/audit
/dev/mapper/vg00-crashvol
45G 77M 43G 1% /var/crash
/dev/mapper/vg00-homevol
4.7G 44M 4.4G 1% /home
/dev/mapper/vg02-RhelRepo
9.9G 7.7G 1.7G 83% /var/repo
/dev/cciss/c0d0p1 251M 23M 216M 10% /boot

Command used #
df -hx tmpfs -x swap -x iso9660

why?
to exclude swap and iso9660 filesystem type.

what is required now?
Option1:
Is there a way wherein we give both the file system type with only one "-x" in the above given command?
Option2:
How to declare this as a variable in the beginning of the script? e.g. TYPE=iso9660,swap,tmpfs,etc.

Rsync-/usr/bin/rsync: Argument List Too Long

Hi
I am trying to send lakh of small(JPG,PDF) files from one server to another. So am using rsync which helps differential copy, but when using it getting error as /usr/bin/rsync: Argument list too long.

Kindly help, other than rsync if any option is also there kindly update.

Thanks in advance


sswaran

Rsync Operations Not Permitted

hello guys, just want to ask I have files on the server running SUSE 11 and i rsync to My WD Cloud via NFS.

but i notice some it shows some error like "This operation is not permitted"

I had used rsync -av parameters.

But when I used rsync -rltuv parameters it seems to work fine.

Why rsync -av parameter is used there are errors even though I set on WD My Cloud shared folder as the permissions as 777?

Thanks for any input.

Rsync Question

Hey guys, I have rsync going to another remote server
it works good, however, lets say server A deleted a directory, server B wont sync up to it.

if I were to add a directory to Server A, then server B will add it as well. so server B is just not deleting stuff.

is there a proper rsync command i can use ?

would rsync -xzva --delete /src /dst delete everything and start the rsync from scratch? or is there another way to do this

Rsync Without A Checksum Check? Centos 7

Hi All,
I am trying to perform an rsync without a check sum verification at the end of the copy.

I have tried both the -W (whole file) and the --no-checksum option and at the end of both file copies it performs a verification.


Code:
[root@centsrv01 /]# nice -n 20 rsync -avz --no-checksum  --bwlimit=2000 --progress /opt/vidconvert/converted/testfile.mp4 /opt/RouterUSB/TV/ChromeCast/
sending incremental file list
testfile.mp4
  1400440237 100%    1.94MB/s    0:11:28 (xfer#1, to-check=0/1)


I am copying from an XFS filesystem to a NTFS (CIFS) file system to a Samba share. Unfortunalty NFS is not an option.

Any Ideas?

Thanks