LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rsync keeps deleting another dir (https://www.linuxquestions.org/questions/linux-software-2/rsync-keeps-deleting-another-dir-612696/)

subzero80 01-10-2008 04:17 PM

Rsync keeps deleting another dir
 
I am trying to run the command below to sync are development server to our production server. For some reason it keeps giving me the results below which I have no clue why it keeps doing that.

On development server:
development$ rsync -avb --delete -n --exclude "*bak" /srv/websites/hold/test/ production:/srv/websites/hold/test/

results
created directory /srv/websites/hold/test/ <-- Correct since the folder is not on the production server.

Below is not correct! It's trying to delete everything from my home dir on the production server. I have no clue why it is doing that. Does anyone have feedback on what is causing this? Thanks for the help.

deleting .zshrc
deleting .ssh/known_hosts
deleting .ssh
deleting .emacs
deleting .bashrc
deleting .bash_profile
deleting .bash_logout
deleting .bash_history

Tinkster 01-10-2008 04:51 PM

Their non-existance on the source machine in the directory test?



Cheers,
Tink

subzero80 01-11-2008 08:49 AM

Their is files in the test dir on development system. It creates the the folder and copies the files but then it tries to erase my home dir on the production server while it is sync the data.

Tinkster 01-11-2008 01:14 PM

Check on the destination box whether there's dot-files in the target
directory. If there are (I can't tell you how they got their, maybe
you did a previous run from a different source dir?) - and I'm pretty
certain there will be - the command you issued will rightfully try to
delete them since you explicitly asked it to.



Cheers,
Tink

subzero80 01-11-2008 03:59 PM

The dot files are in my /home/MY user dir on the production server. For some strange reason it's trying to delete the contents of my home dir. It does the same thing with another login account. So I am really confused on what is causing this.

deleting .zshrc
deleting .ssh/known_hosts
deleting .ssh
deleting .emacs
deleting .bashrc
deleting .bash_profile
deleting .bash_logout
deleting .bash_history

Tinkster 01-12-2008 01:29 AM

I appreciate that those dot-files also exist in your home,
they would on many a linux machine. What I'm trying to say is
that rsync is too mature to try and delete stuff from a spot
that it clearly has no dealings with. Also the deletion would
happen on the target end, not on the sender.

Did you bother to check the target directory on the server
for the existence of those files?



Cheers,
Tink

xptools 01-12-2008 01:42 PM

Quote:

Originally Posted by Tinkster (Post 3018297)
Their non-existance on the source machine in the directory test?

subzero80, it seems you had never answered Tinkster's above question.

The files (.zshrc etc) to be deleted are not from your home directory but from production:/srv/websites/hold/test/. Are you sure you want them to be there?

Get familiar with rsync first, see Suggested rsync usage.

subzero80 01-14-2008 09:32 AM

There is no /test/ dir on the production server. Rsync suppose to create the directory which is does. I created a test file in my /home dir on the production server to see if that is the location it is trying to delete from. It is trying to delete files from my home dir on production server. I tried the --delete-after option to see if that would correct the issue but it still gave me the same result.

deleting websites
deleting testk <--- This is a file that I created in home dir on production server.
deleting .zshrc
deleting .ssh/known_hosts
deleting .ssh
deleting .emacs
deleting .bashrc
deleting .bash_profile
deleting .bash_logout
deleting .bash_history

subzero80 01-15-2008 03:14 PM

I figured it out. For some reason if I don't remove the test/ <-- "/" on the source directory it will try to delete everything on my production home dir. Must be something with creating folder.


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