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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Laptop/Desktop... Back up/Mirror script.
# 1  
Old 03-19-2008
**SOLVED**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?

Quote:
rsync -avz -e 'ssh -p 22' --ignore-errors --exclude=/home/<user>/Music /home/<user>/ <user>@<remotemachine>:/home/<user>/
Please help me make it right... Thanks.

Last edited by komputersman; 03-19-2008 at 07:04 PM..
# 2  
Old 03-19-2008
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
# 3  
Old 03-19-2008
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

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

and to pull

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

/Lakris
# 4  
Old 03-19-2008
Thanks for your responses...

Shawn: I will try your suggestions...

Lakris: No error message: Yes I removed the real names to protect the guilty... :-)
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.
# 5  
Old 03-19-2008
Here is what worked...
Quote:
rsync -av --exclude="Music" /home/<user> <user>@Laptop:/home
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?
# 6  
Old 03-20-2008
Good! For multiple patterns You use another --exclude, as in
Code:
rsync -av --exclude="Music" --exclude=Pics /home/<user> <user>@Laptop:/home

Btw, I just had to test it myselfSmilie and it works using exclude pattern with / (slash) in it and without quotes. You need it when pattern for example contains spaces:
Code:
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$

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Spooling File to My Desktop From Back-end using shell script

Hello all, I am trying to spool a SQL query output file from back-end to desktop in a certain path but it didn't work,the query writes the output in a file in the same directory at the back-end. note : i use the same query in sql developper and file was created in the desired path fine code... (1 Reply)
Discussion started by: bmaksoud
1 Replies

2. Ubuntu

Laptop to laptop transfer files

Dear all, I would like to transfer my old laptop documents/files etc to the new laptop without using any external hard disk. Please let me know if its possible via any way. Thank in advance, emily (3 Replies)
Discussion started by: emily
3 Replies

3. HP-UX

What is the difference between DRD and Root Mirror Disk using LVM mirror ?

what is the difference between DRD and Root Mirror Disk using LVM mirror ? (3 Replies)
Discussion started by: maxim42
3 Replies

4. Hardware

Connect SATA Laptop HardDrive to Desktop SATA Slots

Hello everybody, I need to connect a laptop 2.5 SATA hard drive to a Desktop board (which uses 3.5' SATA hard drives). I've tried the connectors and they fit excellent in the 2.5 SATA connectors. The problem is that the laptop hard drive uses 5v and the PC's power source sends 12v. So, my... (4 Replies)
Discussion started by: Zykl0n-B
4 Replies

5. Ubuntu

Connect 2 laptops with RJ45 cable (Ubuntu 10.10 laptop with Windows 7 laptop)

Hi to all, I have the problem that a laptops with windows XP cannot startup even in safe mode nor using last good known configuration. I have a Ubuntu 10.10 Live CD and booting from it I can read the Hard Drive. I need to do a backup the Hard Drive from XP laptop and I want to connect this... (5 Replies)
Discussion started by: cgkmal
5 Replies

6. Solaris

What is mirror and sub mirror in RAID -1 SVM

Hi , I am new to SVM .when i try to learn RAID 1 , first they are creating two RAID 0 strips through metainit d51 1 1 c0t0d0s2 metainit d52 1 1 c1t0d0s2 In the next step metainit d50 -m d51 d50: Mirror is setup next step is metaattach d50 d52 d50 : submirror d52 is... (7 Replies)
Discussion started by: vr_mari
7 Replies

7. Solaris

ZFS Mirror versus Hardware Mirror

I've looked a little but haven't found a solid answer, assuming there is one. What's better, hardware mirroring or ZFS mirroring? Common practice for us was to use the raid controllers on the Sun x86 servers. Now we've been using ZFS mirroring since U6. Any performance difference? Any other... (3 Replies)
Discussion started by: Lespaul20
3 Replies

8. Debian

Laptop waking up in bag: go back to sleep script

I have a Debian-derived distro (Kubuntu 8.04) running on a Dell Inspiron laptop. This laptop often wakes from RAM suspension while in my bag. I would like to run a script, upon RAM suspension wake, that would detect if the lid switch is closed. If so, then the script should put the machine back in... (0 Replies)
Discussion started by: dotancohen
0 Replies

9. Shell Programming and Scripting

Back-up/Mirror entire website

Hi all, I would like to backup the entire unix.com website in my system is it possible ?? i have hered about wget and curl will it possible to back up using wget ?? I have cygwin in window machine which have wget support . I don't know the syntax of doing the job. I am under a proxy... (2 Replies)
Discussion started by: jambesh
2 Replies
Login or Register to Ask a Question