Created
July 25, 2013 01:57
-
-
Save songxiaofeng1981/6076287 to your computer and use it in GitHub Desktop.
rsync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Rsync Cc@Snp | |
## function | |
default(){ | |
echo ' | |
##################### | |
1,创建服务端 | |
##################### | |
2,配置客户端 | |
##################### | |
' | |
} | |
default | |
echo -en "请输入你要创建的项目:" | |
read num | |
case $num in | |
1) | |
## Read path | |
echo -en "请输入要创建的项目名称:" | |
read name | |
echo -en "请输入你要同步的绝对路径:" | |
read newpath | |
echo -en "请输入允许同步的IP:" | |
read ip | |
## Install | |
echo " | |
transfer logging = true | |
log format = %h %o %f %l %b | |
gid = root | |
uid = root | |
use chroot = no | |
max connections = 4 | |
pid file = /var/run/rsyncd.pid | |
lock file = /var/run/rsync.lock | |
log file = /var/log/rsyncd.log | |
read only = true | |
[$name] | |
path=$newpath | |
read only = false | |
hosts allow = $ip | |
uid = root | |
" >>/etc/rsyncd.conf | |
if [ -f /etc/rsyncd.conf ];then | |
rsync --daemon --config=/etc/rsyncd.conf | |
else | |
exit 1; | |
fi | |
# | |
;; | |
2) | |
echo ok | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment