Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-06 21:16:26 -06:00
parent b680e073d5
commit faedef115a

View File

@@ -144,7 +144,7 @@ CERTRENEW(){
if [ "`date +%s`" -gt "$timeout" ]; then
echo 'timeout'
exit 1
break
fi
done
SERVICE nginx reload 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun
@@ -154,7 +154,28 @@ NIGHTLYRENEW(){
do_with_root $CERT_DAEMON renew --webroot -w /var/www/html &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
do_with_root chown -R root:letsencrypt /etc/letsencrypt &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
do_with_root chmod -R 6775 /etc/letsencrypt &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
sleep 20
yes | cp -rfH /opt/idssys/nodemgmt/cert-renewal.lastrun /etc/letsencrypt/cert-renewal.lastrun
daterun=`date +%Y-%m-%d-%H-%M`
echo -e "${daterun}" >> /etc/letsencrypt/cert-renewal.lastrun
checked=false
timeout=`date --date='10 seconds' +%s`
until [ "${checked}" = "" ]; do
tchecked=''
for nip in "${NODE_HOSTS[@]}"; do
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''
else NCMD="ssh root@${nip}"
fi
if [ "${NCMD}" != "" ]; then
tchecked+=`${NCMD} "cat /etc/letsencrypt/cert-renewal.lastrun" | diff - /etc/letsencrypt/cert-renewal.lastrun`
fi
done
checked=${tchecked}
if [ "`date +%s`" -gt "$timeout" ]; then
echo 'timeout'
exit 1
fi
done
SERVICE nginx reload &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
}