Skip to content

Instantly share code, notes, and snippets.

@songxiaofeng1981
Created July 25, 2013 01:57
Show Gist options
  • Save songxiaofeng1981/6076287 to your computer and use it in GitHub Desktop.
Save songxiaofeng1981/6076287 to your computer and use it in GitHub Desktop.
rsync
#!/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