加入如下代碼:
CentOS 6.3 Rsync文件同步
一、服務端配置
1.安裝
yum
install rsync xinetd
2.編輯配置文件
在/etc目錄下創建一個rsyncd的目錄
mkdir
/etc/rsyncd
創建rsyncd.conf
,這是rsync服務器的配置文件
touch
/etc/rsyncd/rsyncd.conf
創建rsyncd.secrets
,這是用戶密碼文件
touch
/etc/rsyncd/rsyncd.secrets
爲了密碼的安全性,把權限設爲600
chmod 600
/etc/rsyncd/rsyncd.secrets
創建rsyncd.motd文件,這是定義服務器信息的文件
touch
/etc/rsyncd/rsyncd.motd
syncd.conf文件內容:
pid file
=/var/run/rsyncd.pid
port=873
address=192.168.1.250
#uid = nobody
#gid = nobody
uid=root
gid=root
use chroot=yes
read only=yes
#limit access to private LANs
hosts allow=192.168.1.0/255.255.255.0
hosts deny=*
max connections=5
motd file =/etc/rsyncd/rsyncd.motd
#This will give you a separate log file
#log file = /var/log/rsync.log
#This will log every file transferred - up to 85,000+ per
user, per sync
#transfer logging = yes
log format=%t %a %m %f %b
syslog facility=local3
timeout =300
[ftphome]
path=/opt/ftp/
list=yes
#ignore errors
auth users =sunny
secrets file =/etc/rsyncd/rsyncd.secrets
comment =ftphome
exclude =upload/
[svn]
path =/opt/svn
list=no
#ignore errors
comment = svn
auth users =sunny
secrets file = /etc/rsyncd/rsyncd.secrets
密碼文件:/etc/rsyncd/rsyncd.secrets的內容
user:password
rsyncd.motd 文件;
#定義rysnc
服務器信息,也就是客戶端登錄顯示的信
+++++++++++++++++++++++++++
+ welcome rsync 2013
+
+++++++++++++++++++++++++++
啓動rsync服務:
/usr/bin/rsync --daemon
--config=/etc/rsyncd/rsyncd.conf
客戶端配置:
1.安裝rsync
2.執行同步
rsync -vazu
--progress [email protected]::ftp
/home/sunny/rsync/ftp
3.客戶端自動同步
crontab -e
加入如下代碼:
加入如下代碼:
10 0 * * * rsync
-avzP --delete
--password-file=rsync.password
[email protected]::ftp
/home/sunny/rsync/ftp
表示每天0點10分執行同步
附windows局域網備份同步腳本
#mysql數據庫備份
mysqldump
-uroot -p123456789 -R store >
E:\bak\�te:~0,10%store.sql
del
e:\bak\store.zip
#壓縮
c:\zip.exe -j e:/bak/store.zip
e:/bak/�te:~0,10%store.sql
if exist
"c:\lock.db" exit
ping -n 1
127.0.0.1>lock.db
net use y: \\192.168.1.20\d$
"12345" /user:"admin"
xcopy /e /d
/y /c e:\bak\file\* y:\bak\file\
xcopy /e /d
/y /c e:\bak\store.zip y:\bak\sql\
ping -n 1
127.0.0.1>null
del c:\lock.db
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.