rsync 自动安装脚本
#!/bin/bash
#home_page http://grapedlinux.cn
rpm -q rsync &>/dev/null;
rpm -q xinetd &>/dev/null || yum install rsync xinetd --nogpgcheck -y &>/dev/null
t=$(echo $?)
if [[ "$t" != 0 ]];then
echo "rsync is not install,try to install is faild,please check you yum configure or network! "
exit 5
fi
sed -i 's/yes/no/' /etc/xinetd.d/rsync
cat > /etc/rsyncd.conf <<EOF
uid = root
gid = root
user chroot = no
max connections = 0
[nginxconf]
path=/usr/local/nginx/conf/
ignore errors
read only = yes
list = no
hosts allow = 10.15.6.50
auth users = syncuser
secrets file = /etc/server.pass
[blogdata]
path=/data/blog_data_bak/
ignore errors
read only = yes
list = no
hosts allow = 10.23.16.8
auth users = syncuser
secrets file = /etc/server.pass
EOF
cat > /etc/server.pass <<EOF
syncuser:password-not-found
EOF
chmod 600 /etc/server.pass
service xinetd restart &>/dev/null
res=$(netstat -nutlp | grep 873 | grep -v grep | wc -l)
if [[ $res -ne 1 ]];then
echo "Something wrong! please check."
fi
cat <<EOF
Rynsc configure is success!
config file is /etc/rsyncd.conf
pass file is /etc/server.pass
EOF