歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> rsync服務器與客戶端配置文件

rsync服務器與客戶端配置文件

日期:2017/3/1 16:27:50   编辑:關於Linux
rsync服務器與客戶端配置文件 目標服務器端配置文件 [rsyncd.conf] uid = nobody gid = nobody use chroot = no max connections = 10 strict modes = yes pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log #模塊名 [web1] #目標服務器目錄 path = /usr/local/rubyzhu/test comment = web1 file ignore errors = yes read only = no write only = no list = false hosts allow = 127.0.0.1 hosts deny = * uid = root gid = root #認證用戶名,與操作系統用戶無關 auth users = backup secrets file = /etc/rsyncd.secrets 客戶端配置文件(被監控系統) [inotify-tool.sh 自寫腳本] #!/bin/sh src=/usr/local/rubyzhu/test1/ #inotify監控的目錄 des1=web1 #rsync服務器模塊 ip1=127.0.0.1 #目標服務器的IP地址 user=backup #目標服務器的rsyncr的web1模塊的用戶名,跟操作系統用戶名無關 /usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' \ -e close_write,modify,create,attrib,delete \ ${src} \ | while read file do rsync -avz --delete --progress --password-file=/etc/server.pass ${src} ${user}@${ip1}::${des1} && #rsync -avz --delete --progress --password-file=/etc/server.pass ${src} ${user}@${ip2}::${des2} && echo "${src} was rsynced" echo "-----------------------------------------------------" done
Copyright © Linux教程網 All Rights Reserved