diff --git a/ncac/centos7/setup.sh b/ncac/centos7/setup.sh index 0a7fe5c..2a30131 100644 --- a/ncac/centos7/setup.sh +++ b/ncac/centos7/setup.sh @@ -284,6 +284,12 @@ install61850(){ #################### 加入开机启动 ################################################ +setWaitDbStart(){ + echo 'while ! systemctl is-active --quiet mysqld; do' >> /etc/rc.d/rc.local + echo ' sleep 1' >> /etc/rc.d/rc.local + echo 'done' >> /etc/rc.d/rc.local + echo "" +} setAutoStartCac(){ if [ `grep -c ${BIN_DIR}/startCac.sh /etc/rc.d/rc.local` -eq '0' ]; then echo '#NewCAC' >> /etc/rc.d/rc.local @@ -368,6 +374,7 @@ fi if [ $MYSQL_INS == 1 ]; then installDatabase + setWaitDbStart fi if [ $DB_CREATE == 1 ]; then createDatabase diff --git a/ncac/ubuntu22/setup.sh b/ncac/ubuntu22/setup.sh index 4db5303..d515126 100644 --- a/ncac/ubuntu22/setup.sh +++ b/ncac/ubuntu22/setup.sh @@ -257,6 +257,12 @@ install61850(){ #################### 加入开机启动 ################################################ +setWaitDbStart(){ + echo 'while ! systemctl is-active --quiet mysqld; do' >> /etc/rc.local + echo ' sleep 1' >> /etc/rc.local + echo 'done' >> /etc/rc.local + echo "" +} setAutoStartCac(){ if [ `grep -c ${BIN_DIR}/startCac.sh /etc/rc.local` -eq '0' ]; then echo '#NewCAC' >> /etc/rc.local @@ -299,6 +305,7 @@ updateFirewall(){ ufw allow 443/tcp ufw allow 3306/tcp ufw allow 102/tcp + ufw allow 123/tcp } @@ -337,6 +344,7 @@ fi if [ $MYSQL_INS == 1 ]; then installDatabase + setWaitDbStart fi if [ $DB_CREATE == 1 ]; then createDatabase