- yum -y install rsync
- #!/bin/bash
- #down&update rsync
- yum -y install rsync
- #setup rsync
- if [ ! -d /etc/rsync ]
- then
- mkdir -p /etc/rsync
- cd /etc/rsync
- wget -c ***1.zhaizu.com/rsyncd.conf
- wget -c ***1.zhaizu.com/rsyncd.motd
- wget -c ***1.zhaizu.com/rsyncd.secrets
- chown root:root * -Rf
- chmod 600 * -Rf
- else
- cd /tmp
- tar -cf rsync.bak /etc/rsnyc
- cd /etc/rsync
- rm -rf *
- wget -c ***1.zhaizu.com/rsyncd.conf
- wget -c ***1.zhaizu.com/rsyncd.motd
- wget -c ***1.zhaizu.com/rsyncd.secrets
- chown root:root * -Rf
- chmod 600 * -Rf
- fi
- #useradd rsync user
- id BackupUser
- if [ $? -ne 0 ]
- then
- useradd BackupUser -s /sbin/nologin
- fi
- if [ ! -d /tmp/update-resource ]
- then
- mkdir -p /tmp/update-resource
- fi
- #autostart-rsync
- echo 'usr/bin/rsync --daemon --config=/etc/rsync/rsyncd.conf' >> /etc/rc.local
- #iptables accept setup
- iptables -I INPUT -p tcp --dport 873 -j ACCEPT
转载于:https://blog.51cto.com/fghjk/950162