feat:CAC增加NTP安装脚本

main
郭承 5 months ago
parent ab3314ed9b
commit 9fec2b5195

@ -62,6 +62,33 @@ createDatabase(){
sleep 1
}
#################### 安装NTP ###################################################
installNTP(){
echo "************[installing NTP]正在安装NTP >>>>>>>>>>>>>"
echo ""
if [ ! `rpm -qa | grep ntp- | wc -l` -ne 0 ]; then
rpm -ivh package/ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm
sleep 1
fi
sed -i 's/^[^#]*server 0.centos.pool.ntp.org iburst*/#&/g' /etc/ntp.conf
sed -i 's/^[^#]*server 1.centos.pool.ntp.org iburst*/#&/g' /etc/ntp.conf
sed -i 's/^[^#]*server 2.centos.pool.ntp.org iburst*/#&/g' /etc/ntp.conf
sed -i 's/^[^#]*server 3.centos.pool.ntp.org iburst*/#&/g' /etc/ntp.conf
if [ `grep --color=auto -c "server 127.127.1.0" /etc/ntp.conf` == '0' ]; then
sed -i '/server 3.centos.pool.ntp.org iburst/a\\nserver 127.127.1.0' /etc/ntp.conf
sed -i '/server 127.127.1.0/a fudge 127.127.1.0 stratum' /etc/ntp.conf
fi
echo ""
systemctl restart ntpd
sleep 1
echo " 重启NTP ..."
echo ""
systemctl disable chronyd
systemctl enable ntpd
}
#################### 安装OpenJDK ################################################
installJDK(){
echo "************[prepare to install OpenJDK]准备开始装OpenJDK >>>>>>>>>>>>>"
@ -334,6 +361,10 @@ if [ ! -e "/etc/rc.d/rc.local" ]; then
fi
chmod +x /etc/rc.d/rc.local
if [ $NTP_INS == 1 ]; then
installNTP
fi
if [ $MYSQL_INS == 1 ]; then
installDatabase
fi

@ -1,6 +1,9 @@
### 安装根目录 ###
BASE_DIR=/home/xydl
### 是否安装NTP ###
NTP_INS=1
### 是否安装数据库 ###
MYSQL_INS=1
### 是否建库建表 ###

Loading…
Cancel
Save