LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2014, 07:07 PM   #1
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Rep: Reputation: 28
rsync not writing to existing directories


hi guys,

why is my rsync not writing to data (existing data)
instead it creates a folder called data* and it is working fine...but why wont it sync to my existing folders...any help appreciated
 
Old 02-03-2014, 08:18 PM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
how about you tell us exactly what code you used to verify that rsync is not working... odds are one of your arguments or your path is bad, or both.
 
Old 02-03-2014, 08:22 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,959

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
It would have been nice if you had shown the actual command you used, but I'm guessing
Code:
rsync [options] data /somewhere/else/data
which will take the existing folder data and its contents and store them in the destination.

In contrast
Code:
rsync [options] data/ /somewhere/else/data
                    ^
(note the trailing slash on "data/") will store the contents of the folder data in the destination.
 
Old 02-04-2014, 04:09 PM   #4
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Original Poster
Rep: Reputation: 28
so i copied my data onto a hard drive and then chucked it into the home directory on my centos box 20km away...

im running this script from a cygwin shell on my windows server 2008r2...but the same thing is happening with a similar script pointing to a local usb hard drive...it also creates dir* and doesnt seem to sync

here is my simple script:

#!/bin/bash

rsync -auv --delete /cygdrive/f/agrigriddata CPuser@193.1.212.41:companydata/adegrow/agrigriddata
rsync -auv --delete /cygdrive/f/agrigridusers/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/adegrow1/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/adegrowOffice/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/candtdata/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/engineering/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/Manager101/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/oldsage/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/photos/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/PSTbugmail/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/Pumplink/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/R5share/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/SageLine50/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/SageV10Accounts/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/Transfer/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/Users/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/WorkSheets/ CPuser@193.1.212.41:companydata/adegrow
rsync -auv --delete /cygdrive/d/sage/sage200vpn/ CPuser@193.1.212.41:companydata/adegrow
 
Old 02-05-2014, 04:30 PM   #5
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Original Poster
Rep: Reputation: 28
any help please...do i have something wrong here?
 
Old 02-05-2014, 06:25 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,959

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
If you would show an example of the rsync output messages and what gets created/updated, perhaps just for the first two rsync lines in that script, then someone might be able to help. Otherwise, there's not much to go on. It might be more obvious if you started with an empty destination directory.
 
Old 02-05-2014, 08:05 PM   #7
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,380

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
You appear to be dumping the contents of your source dir's into companydata/adegrow and also deleting the previously rsync'ed data (that doesn't exist in the current source).
So at the end of your script I would expect companydata/adegrow to ONLY contain a copy of what is in /cygdrive/d/sage/sage200vpn/

Presumably that is not what you want...
 
Old 02-06-2014, 06:29 AM   #8
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Original Poster
Rep: Reputation: 28
yes i want to have it so if a file is deleted, it is deleted on the backup (maybe this is a bad idea, in case of accidental file deletions???) i cant do a straight copy as its over the internet and i tried once and it failed (timed out) so i wanted to place files on the remote centos server hoping that the sync would be a lot faster

i will redirect output to a text file and upload it here when i get a chance...thanks for the replies
 
Old 02-06-2014, 12:10 PM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,959

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
descendant_command made the good catch. Each rsync command with a "--delete" option will delete from the destination anything that does not exist in the source for that command. The net result will be that only the files from the last rsync command will remain and everything else will be deleted.

To make "--delete" work the way you need it to, you would need to combine everything into one rsync command with multiple sources.
 
Old 06-10-2014, 04:06 PM   #10
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 447

Original Poster
Rep: Reputation: 28
Still battling with this...havent had much time recently to look at it...backing up onto external hard drives using rsync is working perfectly but no matter how i try to structure the path using / at the end etc...it always makes a new copy...i just cant get it to sync the data...is it possibly a write permissions problem?
 
Old 06-10-2014, 04:46 PM   #11
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
It's very simple

A trailing slash on the destination does nothing provided the destination is a directory that currently exists. A trailing slash on the source has a very specific effect:

No trailing slash - copy the directory and its contents into the destination directory
With trailing slash - copy the contents of the directory into the destination directory

Did you resolve the deletion problem that was explained earlier? What does your command(s) look like now?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Rsync local drives transfers even existing files Lumify Linux - Newbie 3 02-17-2012 07:58 AM
[SOLVED] rsync still copies with ignore existing option digity Linux - Newbie 2 07-14-2010 02:12 PM
rsync not delete non existing files on remote server proNick Linux - Software 2 09-10-2008 04:47 AM
Create home directories for existing users.. thejonmoore Linux - Server 6 05-05-2008 07:10 AM
performance issue: rsync sends existing files microtim Linux - Networking 1 12-02-2004 03:27 AM


All times are GMT -5. The time now is 04:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration