when use with files-from option, it will automatically append $HOME directory to the target directory, so result in a failure:
"/home/myusername/~/workspace/azure-test" No such file or directory (2)
here is the command I used:
rsync -aHv --force --progress --files-from rsync.files . sb:~/workspace/azure-test/
these are the output:
rsync -aHv --force --progress --files-from rsync.files . sb:~/workspace/azure-test/
Warning: Permanently added '10.2.214.53' (ED25519) to the list of known hosts.
building file list ...
2 files to consider
rsync: [Receiver] mkdir "/home/myusername/~/workspace/azure-test" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(789) [Receiver=3.2.7-54-g0db8a943]
however, if I remove the files-from option, then it works.
rsync -aHv --force --progress . sb:~/workspace/azure-test/
the content of rsync.file:
cat rsync.files
./run.sh
Related
when I push and that, on my server, I don't have my project, everything is fine (obviously):
rsync --exclude=".git" -e ssh -avz --delete-after . $SSH_USER#$SSH_HOST:blog_symfony/
building file list ... done
created directory blog_symfony
[...]
sent 44,533,927 bytes received 5,523 bytes 5,239,935.29 bytes/sec
total size is 238,959,003 speedup is 5.37
the problem when I push a 2nd time, it does anything to me:
rsync: [generator] delete_file: rmdir(project/blog_symfony/project/blog_symfony) failed: Permission denied (13)
rsync: [generator] delete_file: rmdir(project/blog_symfony) failed: Permission denied (13)
deleting project/blog_symfony/translations/.gitignore
deleting project/blog_symfony/translations/
[...]
it creates for me, on my server side, a 'project' folder in the blog_symfony folder
annot delete non-empty directory: project/blog_symfony
cannot delete non-empty directory: project
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
sent 13,924 bytes received 175 bytes 28,198.00 bytes/sec
total size is 238,959,004 speedup is 16,948.65
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1
my gitlab-ci:
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
script:
- ls
- apt-get update && apt-get install rsync -y
- ssh $SSH_USER#$SSH_HOST "ls"
- rsync --exclude=".git" -e ssh -avz --delete-after . $SSH_USER#$SSH_HOST:blog_symfony/
- ssh $SSH_USER#$SSH_HOST "cd blog_symfony && docker-compose build && docker-compose up"
in ls -l I have a folder written by rsync and which is impossible to remove from gitlab-ci:
drwxrwxr-x 3 root root 4096 Dec 14 23:26 project
I don't think this is normal. This is the first time that I use gitlab-ci for a symfony project.
Thank you for your help
ls -l: I have a folder written by rsync and which is impossible to remove from GitLab CI.
Check if that folder is instead created after the first execution of your docker-compose up: if your Docker image execute itself internally as USER root, using a bind mount, it would write files/folders as root.
And that would impede normal operation (on the server, outside the container), like your rsync, because root files would be i the way.
I am trying to transfer a file using in remote desktop which will create the directory tree as well in remote desktop as specified.I am using below command but its not working when directory is not present in remote server.
rsync -avzhe ssh --progress /root/BP/temp/temp.txt root#host2:/root/BP/temp2
Where /root/BP/temp/temp.txt is available in local but /root/BP/temp2 this path is not peresent in remote server.
I am getting below error :
rsync: change_dir#3 "/root/BP" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(625) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
If you need to move files to a non existent path on the remote server, you must either:
Model the path and file structure locally and sync a common "ancestor".
This is requires only 1 step
Create the missing directories locally and sync them first then sync the files.
This requires 2 steps
To use the OP's specific example of:
rsync -avzhe ssh --progress /root/BP/temp/temp.txt root#host2:/root/BP/temp2
You would instead do:
# assuming that /root already exists on the remote server
mkdir -p /root/BP/temp/or_wherever/BP/temp2
mv /root/BP/temp/temp.txt /root/BP/temp/or_wherever/BP/temp2
rsync -avzhe ssh --progress /root/BP/temp/or_wherever/BP root#host2:/root/
But if for some reason you cannot move the file in question, you must use the second option:
# assuming that /root already exists on the remote server
mkdir -p /root/BP/temp/or_wherever/BP/temp2
# Notice there is no `/` after the `or_wherever/BP` in the next command
rsync -avzhe ssh --progress /root/BP/temp/or_wherever/BP root#host2:/root/
rsync -avzhe ssh --progress /root/BP/temp/temp.txt root#host2:/root/BP/temp2/
I am currently testing rsync in order to synchronize some file between two servers.
When I espace the parameters of my command line with single quote, rsync seems to failed:
'rsync' '--recursive' '--verbose' '--archive' '--copy-dirlinks' '--rsh="ssh -i /path/to/my/key"' '--delete' '/path/to/my/source/directory' 'user#server:/path/to/my/destination/directory'
rsync: Failed to exec ssh -i /path/to/my/key: No such file or
directory (2) rsync error: error in IPC code (code 14) at pipe.c(85)
[sender=3.1.2] rsync: connection unexpectedly closed (0 bytes received
so far) [sender] rsync error: error in rsync protocol data stream
(code 12) at io.c(226) [sender=3.1.2]
But when I do not escape the parameters, rsync works correctly:
rsync --recursive --verbose --archive --copy-dirlinks --rsh="ssh -i /path/to/my/key" --delete /path/to/my/source/directory user#server:/path/to/my/destination/directory
I am using the 3.1.2 version.
I am doing something wrong ?
I want to rsync everything in mirrors.kernel.org/centos/6/updates/x86_64/Packages/ to a directory on my server. I do NOT want to wind up with a directory structure like ~/mirrors.kernel.org/centos/6/updates/x86_64/Packages/
[joliver#lake ~]$ rsync mirrors.kernel.org/centos/6/updates/x86_64/Packages/ CentOS6/
rsync: change_dir "/home/joliver/mirrors.kernel.org/centos/6/updates/x86_64/Packages" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]
[joliver#lake ~]$ mkdir -p mirrors.kernel.org/centos/6/updates/x86_64/Packages
[joliver#lake ~]$ rsync mirrors.kernel.org/centos/6/updates/x86_64/Packages/ mirrors.kernel.org/centos/6/updates/x86_64/Packages
skipping directory .[joliver#lake ~]$ rsync mirrors.kernel.org/centos/6/updates/x86_64/Packages/ mirrors.kernel.org/centos/6/updates/x86_64/Packages/
skipping directory .
After I have that, I'd like to be able to rsync just the deltas. I suppose just redoing the rsync and then finding all files with a ctime of less that since the last run would suffice, but it would be nice if there was a neater way to grab new / changed files.
rsync -avSHP --delete --exclude "local*" --exclude "isos" \
mirrors.kernel.org::centos/6/updates/x86_64/Packages/ CentOS6/
I would like to use rsync to synchronise my /rsync folder.
I create the rsync users on my 2 servers and configure the ssh key.
I installed rsync, created /rsync folder put chmod 777 on it.
But when I execute
rsync -avz -e ssh rsync#1.2.3.4:/rsync /rsync -p 8682
I have
Unexpected local arg: /rsync
If arg is a remote file/dir, prefix it with a colon (:).
rsync error: syntax or usage error (code 1) at main.c(1246) [Receiver=3.0.9]
("ssh rsync#1.2.3.4 -p 8682" works)
rsync -avz -e 'ssh -p 8682' rsync#1.2.3.4:/rsync /rsync