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 |
Their non-existance on the source machine in the directory test?
Cheers, Tink |
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.
|
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 |
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 |
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 |
Quote:
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. |
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 |
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. |