#!/bin/bash
# 文件名: rsync_client_install.sh
# Author: Shuhui

# 认证密码
AUTH_PASS='1c790a002393c3e022d50a917a3d26fafedf842'

# 认证文件
AUTH_FILE='/etc/rsyncd.auth'


function isroot()
{
	[[ $(id -u) -ne '0' ]] && echo 'Please use root role run this script!' && exit 1
}

function Install_pkg_7()
{
	rsync --help >/dev/null 2 >&1|| yum -y install rsync
}

function Auth_file()
{
	# 生成认证文件并设置权限
	echo "${AUTH_PASS}" > ${AUTH_FILE} && chmod 600 ${AUTH_FILE}
}


isroot
Install_pkg_7
Auth_file
