Update nodemgmt-scripts.sh

This commit is contained in:
2023-04-25 12:29:25 -05:00
parent 176056264b
commit afbf4effc3

View File

@@ -737,15 +737,15 @@ NEWCERT(){
$CERT_DAEMON certonly --webroot -w /opt/lb-data/letsencrypt-acme-challenge -d ${NEW_CERT}
# $CERT_DAEMON certonly --dry-run --webroot -w /var/www/html -d ${NEW_CERT}
if [ -f /etc/letsencrypt/live/${MAIN_CERT}/cert.pem ]; then
if [ -f /opt/lb-data/letsencrypt/live/${MAIN_CERT}/cert.pem ]; then
chown -R root:le /opt/lb-data/letsencrypt
chmod -R 6775 /opt/lb-data/letsencrypt
touch /etc/letsencrypt/live/${MAIN_CERT}/newcert
if [ -f /etc/nginx/sites-enabled/${MAIN_CERT}.conf ]; then
touch /opt/lb-data/letsencrypt/live/${MAIN_CERT}/newcert
if [ -f /opt/lb-data/letsencrypt/${MAIN_CERT}.conf ]; then
rm -f ${FOLDER}/cert-request.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${NEW_CERT}\n${daterun}" > ${FOLDER}/cert-request.lastrun
yes | cp -rfH ${FOLDER}/cert-request.lastrun /etc/letsencrypt/cert-request.lastrun
yes | cp -rfH ${FOLDER}/cert-request.lastrun /opt/lb-data/letsencrypt/cert-request.lastrun
DIVIDER true
echo -en "${idsCL[LightYellow]}Waiting for Cert replication across the nodes... ${idsCL[Default]}"
@@ -755,12 +755,12 @@ NEWCERT(){
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
checked=false
until [ "${checked}" = "" ]; do
checked=`ssh root@${nip} "[ ! -f /etc/letsencrypt/live/${MAIN_CERT}/newcert ] && echo '.'"`
checked=`ssh root@${nip} "[ ! -f /opt/lb-data/letsencrypt/live/${MAIN_CERT}/newcert ] && echo '.'"`
done
fi
fi
done
rm -f /etc/letsencrypt/live/${MAIN_CERT}/newcert
rm -f /opt/lb-data/letsencrypt/live/${MAIN_CERT}/newcert
echo -e "${idsCL[Green]}Completed${idsCL[Default]}"
SERVICE nginx reload
fi