RSYNC.3.脚本实现部署
~]# cat rsync_install.sh
#!/bin/bash
#1.Install Rsync Server
yum install -y rsync
#2.Create User For Rsync
useradd -M -s /sbin/nologin rsync
#3.Create Directory for backup, modify folder properties.
mkdir /backup
chown -R rsync.rsync /backup
#4.modify config file.
cat >/etc/rsyncd.conf<<EOF
uid = rsync
gid = rsync
port = 873
fake super = yes
use chroot = no
max connections = 200
timeout = 600
ignore errors
read only = false
auth users = rsync_backup
secrets file = /etc/rsync.password
log file = /var/log/rsyncd.log
##################################
[backup]
comment = welcome to rsync backup
path = /backup
EOF
#5.create auth file
echo “rsync_backup:1” > /etc/rsync.password
chmod 600 /etc/rsync.password
#6.Start rsync Servers
systemctl start rsyncd &>/dev/null
systemctl enable rsyncd &>/dev/null
systemctl status rsyncd &>/dev/null && echo “rsyncd start successed.”
Comments
…………。