安装rsync脚本

安装rsync脚本

#!/bin/bash
echo ======================================================
read -p "请输入允许同步的IP,多个ip以空格分开:" rsync_ip
echo ======================================================
read -p "请输入要同步的目录:" rsync_data
echo ======================================================
#安装rsync软件
rpm -qa | grep rsync
if [ "$?" == 0 ];
then
    echo "rsync已安装"
else
    yum install -y rsync
fi
#配置rsync
cat > /etc/rsyncd.conf<<EOF
uid = root
gid = root
use chroot = no
max connections = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /data/logs/rsyncd.log
[rsync]
path = $rsync_data
read only = no
hosts allow = $rsync_ip
list = no
auth users = rsync
secrets file = /etc/rsync.pass
EOF
cat > /etc/rsync.pass<<EOF
rsync:xxxxxxxxxx
EOF
sed -i "s/yes/no/g" /etc/xinetd.d/rsync
chmod 600 /etc/rsync.pass
service xinetd restart
运行脚本sh rsync.sh

运行脚本

# sh rsync.sh 
======================================================
请输入允许同步的客户端IP,多个ip以空格分开:

例如:192.168.0.1 10.0.0.0/8
======================================================
请输入要同步的目录:
======================================================
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值