荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: jjksam (Debian GNU/Linux 2.2 (`potato') ), 信区: Linux
标  题: rsync 使用范例
发信站: 荔园晨风BBS站 (Sat Jan 12 16:05:25 2002), 转信

sync 使用范例

The following is an example which will mirror both the web and ftp site. You
will have to modify the machine name and the directories involved to match your
 situation.

The lockfile is useful if you run this using a cron job. If, for any reason,
the mirror doesn't complete, the next time the mirror tries to run you will get
 mail. You can then track down where the problem lies, fix it, delete the
lockfile and the mirror will work properly the next time it is run.

set -e

lockfile -r 1 rsync.master.lock || exit 23

rsync -avz -e ssh --exclude .glbuild --delete <machine>:/web/debian.org/
debian.org
rsync -avz -e ssh --delete <machine>:/web/debian.org-local/ debian.org-local

echo FINISHED UPDATING WEB. WORKING ON FTP NOW.

rsync -avz --delete -e ssh <machine>:/debian debian

rm -f rsync.master.lock


How to set up ssh so you aren't asked for a password:

The script given above will prompt you for a password unless you set up ssh a
certain way. First, when you use ssh-keygen, just hit return when asked for a
password [1]. Next, add the contents of ~/.ssh/identity.pub to ~/.
ssh/authorized_keys on the mirror site (the file should be mode 600). You
should then be able to use ssh to log in to the mirror site without being asked
 for a password.

[1] Note that setting up ssh with a blank password gives an intruder free
access to the site you are mirroring once they have broken into your site.
For this reason, this should never be done from root.
--
         ╱▉ ____ ____ ● ●       ╱▉     __▃_
       ╱__▉ ▉__ ▉   ▉ ▉     ╱__▉ ▉╱  ▉
   __╱    ▉ __▉_▉___▉_▉___╱    ▉_▉    ▉_
 ─────────────────────────

※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.0.146]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店