I am trying to execute rsync command through a subprocess and popen. Everything is fine until I put the rsh subcommand, where everything goes wrong.
from subprocess import Popen
args = ['-avz', '--rsh="ssh -C -p 22 -i /home/bond/.ssh/test"', 'bond@localhost:/home/bond/Bureau', '/home/bond/data/user/bond/backups/']
p = Popen(['rsync'] + args, shell=False)
print p.wait()
print ' '.join(['rsync']+args)
I tried to avoid "-rsh =" ssh -C -p 22 -i / home / bond / .ssh / test "in different ways, but it seems like this is not a problem.
I get an error rsync: Failed to execute exec ssh -C -p 22 -i / home / bond / .ssh / test: There is no such file or directory (2)
If I copy / paste the same arguments that I was outputting at that time, I get the correct execution of the command.
Thank.
source
share