Rsync is a powerful synchronization tool. Many projects provide http ftp rsync and other mirror methods. The official homepage of rsync is http://samba.anu.edu.au/rsync /. Rsync (d) Server start in two ways: 1. daemon 2. after xinetd is started, it is bound to TCP/873 port Java code % cat/etc/xinetd. d/rsync # default: off # description: The rsync server is a good addition to an ftp server, as it \ # allows crc checksumming etc. service rsync {disable = no socket_type = stream wait = no user = root server =/usr/bin/rsync server_args = -- daemon log_on_failure + = USERID} configure the primary Java code % cat/etc/rsyncd. conf motd file =/var/log/rsync/welcome. msg pid file =/var/log/rsync/rsyncd. pid lock file =/var/log/rsync. lock log file =/var/log/rsync/rsyncd. log [rsyncwww] comment = rsync www path =/var/www/use chroot = no max connections = 4 read only = false list = true uid = nobody gid = nobody # by www.jbxue.com auth users = wwwuser secrets file =/etc/rsyncd. secrets hosts allow = 1.1.1.1, 2.2.2.2 hosts deny = 0.0.0.0/0 ignore errors = yes transfer logging = yes log format = "% a % f % l" # log format = "% o % h [% a] % m (% u) % f % l "[rsyncroot] comment = rsync root path =/use chroot = no max connections = 4 read only = true # read only = false list = true uid = root gid = root auth users = rootuser secrets file =/etc/rsyncd. secrets hosts allow = 1.1.1.1, 2.2.2.2 hosts deny = 0.0.0.0/0 ignore errors = yes transfer logging = yes log format = "% a % f % l" rsyncd. secrets has one user name in one row: use the Java code rsync-auvPz -- progress dir1 dir2 rsync-ztruvoglpD -- progress dir1 dir2 rsync-ztruvoglpD -- progress dir1/dir2 rsync-upgrade -- progress dir1/file1 dir2 if you do not want to include directory/file can be set -- exclude remote use Java code rsync 1.1.1.1:: Only column list rsync user@1.1.1.1: rsync user@1.1.1.1: module rsync user@1.1.1.1: module/path if rsync server is not configured, you can use the Java code rsync-e ssh-auvPz 1.1.1.1 via ssh: /etc. /pay attention to the synchronization/the last problem do not put/the directory name also contains mirror put/only the contents of the mirror Java code rsync-ztruvoglp -- progress user@1.1.1.1 :: module/path. /For the convenience of script calling, you can also call -- password-file. Likewise, you can set the environment variable RSYNC_PASSWORD = to access rsync with user authentication.