Tuesday, January 03, 2012

快速操作Gnome-shell

找到了一篇對於Gnome-shell不錯的鍵盤與滑鼠的快速操作說明,先收藏起來。

Synchronize files by rsync between two Linux hosts

有別於以往先手動交換主機間SSH的金鑰後再透過rsync於兩台主機間同步檔案,今天又學習到了一個新方法,在此稍做筆記。

需求:
將/var/www/html自動從HostA同步到HostB。
HostA: 10.10.2.126 (source)
HostB: 10.10.2.128 (destination)

Step:
1. 設定HostA(Destination):
1.1 確定有安裝rsync:
[root@server1 ~]# rpm -qa | grep -i rsync
rsync-3.0.6-5.el6_0.1.i686
1.2 編輯/etc/xinetd.d/rsync:
service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
1.3 建立/etc/rsyncd.conf:
# any name you like
[test]
# destination directory
path = /home/backup
# Hosts you allow to copy (specify source Host)
hosts allow = 10.10.2.126
hosts deny = *
list = true
uid = root
gid = root
read only = false
1.4 重新啟動xinetd
[root@server1 ~]# /etc/init.d/xinetd restart
正在停止 xinetd: [ 確定 ]
正在啟動 xinetd: [ 確定 ]

2. 設定HostB(Source):
2.1 確定有安裝rsync:
[root@server1 ~]# rpm -qa | grep rsync
rsync-3.0.6-4.el5_7.1
2.2 執行rsync將檔案同步:
[root@server1 ~]# rsync -avz --delete /var/www/html/ 10.10.2.128::test
sending incremental file list
./
proxy.pac
proxy.pac.ipv4
proxy.pac.ipv6
wpad.dat -> proxy.pac
ssl/
ssl/index.hrml

sent 3089 bytes received 174 bytes 6526.00 bytes/sec
total size is 5039 speedup is 1.54