rsync同步服务部署
生活随笔
收集整理的這篇文章主要介紹了
rsync同步服务部署
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
#!/bin/bash
#rsync?no?system?user
#xinetd?rsync(873)
#server
#/root/
#讀取文件記錄集
function?ReadLine()
{cat?$1?|?while?read?linedoif?[?"$2"?=?"$line"?];?thenreturn?1elseresult=0fidonereturn?$result
}rpm?-ivh?xinetd-2.3.14-39.el6_4.x86_64.rpm
rpm?-ivh?rsync-3.0.6-9.el6_4.1.x86_64.rpmsed?-i?"6c?disable?=?no"?/etc/xinetd.d/rsync
chkconfig?xinetd?on
/etc/init.d/xinetd?startrsyncConf=/etc/rsyncd.conf
rsyncArray=(
"uid?=?nobody"?????????????????????????
"gid?=?nobody"???????????????????????????
"address?=192.168.2.63"????#rsync服務(wù)主機(jī)IP???????????????????
"port?=873"???????????????????????????????
"hosts?allow?=192.168.2.64"????#允許同步的服務(wù)器主機(jī)IP????????????????????
"use?chroot?=?yes"???????????????????????????????
"max?connections?=5"?????????????????????????????
"pid?file?=/var/run/rsyncd.pid"????????
"lock?file?=/var/run/rsync.lock"?????????
"log?file?=/var/log/rsyncd.log"??????????
"motd?file?=/etc/rsyncd.motd"
"[wwwroot]"????????????
"path?=/var/www/html"???????????????????????
"comment?=?used?for?web-data?root"????
"read?only?=?yes"?????????????????????????????????
"list?=?yes"?????????????????????????????????????????
"auth?users?=?rsyncuser"?????????#虛擬用戶名???????????????
"secrets?file?=/etc/rsync.passwd"????????
)[?-f?/etc/rsyncd.conf?]
if?[?$??-eq?0?];thenexit?0
elsetouch?$rsyncConf
fifor?((i?=?0;?i?<?${#rsyncArray[@]};?i++))
doReadLine?$rsyncConf?"${rsyncArray[$i]}"if?[?$??=?0?];?thenecho?${rsyncArray[$i]}?>>?$rsyncConffi
doneecho?"Welcome?to?Backup?Server"?>?/etc/rsyncd.motd?#登錄提示信息自行更改
echo?"rsyncuser:123"?>>?/etc/rsync.passwd?#賬戶密碼自行更改
chmod?600?/etc/rsync.passwd
/etc/init.d/xinetd?restart
轉(zhuǎn)載于:https://blog.51cto.com/heyangguang/1894553
總結(jié)
以上是生活随笔為你收集整理的rsync同步服务部署的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Quartz教程:快速入门
- 下一篇: maven deploy distrib