Laptop/Desktop... Back up/Mirror script.

Hello all,
I have a script I am trying to put together, what I am trying to do is mirror my home dir (excluding my music dir) between my desktop and laptop. My intention is to create a cron job to run two scripts, one to push the data to the laptop at the end of the day, and one to pull the data from my laptop in the morning.

Here is what I have and it is not working correctly, it is not excluding my music dir. Also what is the option to include hidden files? Is it -r or -v?

Please help me make it right... Thanks.

The exclude option is meant to match a pattern. I'm thinking your slashes are confusing it.

Try putting it into quotes, or just try making your pattern "Music" instead, at least as a test.

Use the "-n" flag to test it without having to wait for it to actually run everything.

ShawnMilo

Just to avoid misunderstanding...
is there an error message?

Remove the --ignore-errors to options to get meaningful response.

when You type <user> and <remotemachine>, You are actually using a real username and a real address instead, right?

Do You get a prompt asking for password?

The -a option stands for archive mode, which among other things, will include hidden files. -v stands for verbose and -z stands for compressed transfer, not really necessary on a LAN.

If You are using a reasonably recent rsync, it defaults to ssh, so You can probably leave that out as well.

I would type a similar command as, to push

rsync -av --exclude=/home/lakris/Music /home/lakris lakris@laptop:/home

and to pull

rsync -av --exclude=/home/lakris/Music lakris@laptop:/home/lakris /home

/Lakris

Thanks for your responses...

Shawn: I will try your suggestions...

Lakris: No error message: Yes I removed the real names to protect the guilty... :slight_smile:
I get the password prompt, it begins to sync, then I see the "Music" start moving and so I have to stop it then.

Thank you for your examples, although i will try the quotes as Shawn mentiones because "--exclude=/home/user/Music" is not being ignored.

I will post an update in a few.

Here is what worked...

Thank you for your assistance guys.
Kevin

Also by the way, If I want to exclude more then one "pattern" what is the seperator "Music Pics" or "Music; Pics" Just curious?

Good! For multiple patterns You use another --exclude, as in

rsync -av --exclude="Music" --exclude=Pics /home/<user> <user>@Laptop:/home

Btw, I just had to test it myself;) and it works using exclude pattern with / (slash) in it and without quotes. You need it when pattern for example contains spaces:

lakris@ubuntu:~/projekt/scripts/synctest$ find .
.
./src
./src/checkdate.sh
./src/dellast.sh
./src/parse2.sh~
./src/dup-lines.txt
./src/quoted-text.sh~
./src/numberfiles
./src/numberfiles/678.txt
./src/numberfiles/456.txt
./src/numberfiles/586.txt
./src/file.txt
./src/Object4.txt
./src/filestuff
./src/filestuff/names
./src/filestuff/newnames
./src/filestuff/newnames/green
./src/filestuff/newnames/yellow
./src/filestuff/newnames/red
./src/filestuff/oldnames
./src/filestuff/oldnames/file_2
./src/filestuff/oldnames/file_1
./src/filestuff/oldnames/file_3
./src/Object1.txt
lakris@ubuntu:~/projekt/scripts/synctest$ rsync -av --exclude=src/filestuff/names --exclude=src/filestuff/oldnames src trg
building file list ... done
created directory trg
src/
src/Object1.txt
src/Object4.txt
src/checkdate.sh
src/dellast.sh
src/dup-lines.txt
src/file.txt
src/parse2.sh~
src/quoted-text.sh~
src/filestuff/
src/filestuff/newnames/
src/filestuff/newnames/green
src/filestuff/newnames/red
src/filestuff/newnames/yellow
src/numberfiles/
src/numberfiles/456.txt
src/numberfiles/586.txt
src/numberfiles/678.txt

sent 2285 bytes  received 352 bytes  5274.00 bytes/sec
total size is 1229  speedup is 0.47
lakris@ubuntu:~/projekt/scripts/synctest$ find trg
trg
trg/src
trg/src/checkdate.sh
trg/src/dellast.sh
trg/src/parse2.sh~
trg/src/dup-lines.txt
trg/src/quoted-text.sh~
trg/src/numberfiles
trg/src/numberfiles/678.txt
trg/src/numberfiles/456.txt
trg/src/numberfiles/586.txt
trg/src/file.txt
trg/src/Object4.txt
trg/src/filestuff
trg/src/filestuff/newnames
trg/src/filestuff/newnames/green
trg/src/filestuff/newnames/yellow
trg/src/filestuff/newnames/red
trg/src/Object1.txt
lakris@ubuntu:~/projekt/scripts/synctest$