Fabric: rsync between two remote hosts -


i want rsync files remote production server remote backup server using fabric.

server credentials stored in local ~/.ssh/config

host backup      hostname 1.1.1.1      port 33333      user swasher  host production     hostname 2.2.2.2     port 44444     user swasher 

now want run rsync on production machine, , need insert host/user/name of backup server in command, this

@hosts('production') def backup():     run("rsync -avz  -e 'ssh -p {port}' /from/ {user}@{host}:/to/'.format(backup.port, backup.user, backup.host)) 

how can credential of backup server run rsync?

not w fabric job

try copy dirs , nested subdirs local remote:

cmd = "sshpass -p {} scp -r {}/* root@{}://{}".format(     remote_root_pass,      local_path,      remote_ip,      remote_path) os.system(cmd) 

don't forget import os, may check exitcode returned (0 success)

also might need "yum install sshpass"

and change /etc/ssh/ssh_config stricthostkeychecking ask to: stricthostkeychecking no


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -