CentOS一鍵配置rsync服務(wù)器的腳本分享-創(chuàng)新互聯(lián)

這篇文章主要介紹“CentOS一鍵配置rsync服務(wù)器的腳本分享”,在日常操作中,相信很多人在CentOS一鍵配置rsync服務(wù)器的腳本分享問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”CentOS一鍵配置rsync服務(wù)器的腳本分享”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

成都創(chuàng)新互聯(lián)公司是一家專注于做網(wǎng)站、網(wǎng)站設(shè)計與策劃設(shè)計,太白網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:太白等地區(qū)。太白做網(wǎng)站價格咨詢:13518219792

1、保存下面的代碼為一個文件,上傳到服務(wù)器端,名稱為rsync.sh


代碼如下:

#!/bin/bash
#rsync Written by zhumaohai
#For more information please visit http://www.centos.bz
echo "Please input the rsync username:"
read username
echo "Please input the rsync username password:"
read password
echo "Please input the server ip address:"
read serverip
echo "Please input the allow ip address:"
read allowip
echo "Please input the path you want to rsync:"
read rsyncpath
echo "==========================input all completed========================"
echo "==========================install rsync========================"
yum -y install rsync
useradd $username
mkdir /etc/rsyncd
cat >/etc/rsyncd/rsyncd.conf<<eof
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
port = 873
address = $serverip
#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 10.0.1.0/255.255.255.0 $allowip
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
[$username home]
path = $rsyncpath
list=yes
ignore errors
auth users = $username
secrets file = /etc/rsyncd/rsyncd.secrets
eof
echo "$username:$password" > /etc/rsyncd/rsyncd.secrets
chmod 600 /etc/rsyncd/rsyncd.secrets
cat >/etc/rsyncd/rsyncd.motd<<eof
+++++++++++++++++++++++++++
+ centos.bz rsync 2011-2012 +
+++++++++++++++++++++++++++
eof
/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf
ps -aux | grep rsync



2、賦予腳本權(quán)限



代碼如下:


chmod +x rsync.sh



3、執(zhí)行腳本



代碼如下:


./rsync.sh



到此,關(guān)于“CentOS一鍵配置rsync服務(wù)器的腳本分享”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

網(wǎng)站欄目:CentOS一鍵配置rsync服務(wù)器的腳本分享-創(chuàng)新互聯(lián)
文章URL:http://muchs.cn/article8/dhgeop.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、軟件開發(fā)虛擬主機、微信小程序、App設(shè)計、服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)