使用协议
默认使用 RSH协议
也可配置为使用SSH协议
/usr/local/bin/rsync_ssh, as follows:
#!/bin/bash
exec ssh -2 -i /etc/keys/some_rsa_key -o 'CheckHostIP no' \
-o 'ForwardX11 no' -o 'ForwardAgent no' \
-o 'StrictHostKeyChecking no' ${1+"$@"}
-2 即使用 ssh v2 协议
基本应用
% rsync -a /usr/local root@remote_host:/usr/local/
-a 压缩模式
应用示例
Example 7.1. 应用示例
#!/bin/bash
for host in 'cat /usr/local/etc/all_hosts' ; do
rsync -a --delete /usr/local/ root@$host:/usr/local/
done
Example 7.2. 应用示例
rsync -ac --include=/passwd \ # include some files
--include=/shadow \
--include=/group \
--exclude='*' \ # exclude all other files
root@fileserver:/etc/ \ # source
/etc/ # destination