#!/bin/bash 
#Filename: Heartbeat.sh
#Author: shuhui
#Website: http://www.vqiu.cn

# Export Path
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH

# Check Root
if [ $(id -u) != "0" ]; then
    echo "Error: Please use root role to install me!"
    exit 1
fi

# Define Variables


function install() {

	# Install yum repo
	rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm;
	
	# Install
	yum -y install heartbeat
	
}

function config() {
	cd /etc/ha.d; mkdir save_dir; mv authkeys save_dir;mv ha.cf save_dir;mv haresources save_dir;	
	wget -c http://down.vqiu.cn/conf/Linux_conf/heartbeat/common/authkeys;
	wget -c http://down.vqiu.cn/conf/Linux_conf/heartbeat/common/ha.cf;
	wget -c http://down.vqiu.cn/conf/Linux_conf/heartbeat/common/haresources;
	
}


install
config