This commit is contained in:
2023-08-11 16:04:46 -05:00
parent fef03b66ac
commit c2c669b852
3 changed files with 31 additions and 31 deletions

View File

@@ -28,10 +28,10 @@ NEWCERT(){
touch ${NM_CERTPATH}/live/${MAIN_CERT}/newcert
if [ -f ${NM_NGINXPATH}/sites-enabled/${MAIN_CERT}.conf ]; then
rm -f ${NM_FOLDER}/cert-request.lastrun
rm -f ${NM_LOGFOLDER}/cert-request.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${NEW_CERT}\n${daterun}" > ${NM_FOLDER}/cert-request.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-request.lastrun ${NM_CERTPATH}/cert-request.lastrun
echo -e "${NEW_CERT}\n${daterun}" > ${NM_LOGFOLDER}/cert-request.lastrun
yes | cp -rfH ${NM_LOGFOLDER}/cert-request.lastrun ${NM_CERTPATH}/cert-request.lastrun
DIVIDER true
if [ "${2}" != "newsite" ] && [ "${NM_HOSTS['LB']}" != "" ]; then
echo -e -n "${idsCL[LightCyan]}Reload NGINX on LB Nodes (Y/n): ${idsCL[Default]}"
@@ -132,13 +132,13 @@ CERTRENEW(){
echo -e "${idsCL[LightGreen]}Renewing Certificates...${idsCL[Default]}"
echo
sleep 5
$CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun
# $CERT_DAEMON renew --force-renewal --preferred-chain "ISRG Root X1" --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun
# $CERT_DAEMON --dry-run --preferred-chain "ISRG Root X1" renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun
$CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_LOGFOLDER}/cert-renewal.lastrun
# $CERT_DAEMON renew --force-renewal --preferred-chain "ISRG Root X1" --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_LOGFOLDER}/cert-renewal.lastrun
# $CERT_DAEMON --dry-run --preferred-chain "ISRG Root X1" renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_LOGFOLDER}/cert-renewal.lastrun
CONCAT_SSL
chown -R root:le ${NM_CERTPATH} 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
chown -R root:le ${NM_CERTPATH} 2>&1 | tee -a ${NM_LOGFOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} 2>&1 | tee -a ${NM_LOGFOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_LOGFOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun
DIVIDER true
@@ -146,7 +146,7 @@ CERTRENEW(){
# ssh root@webserver-node2.scity.us service nginx start
# echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}"
echo
SERVICE nginx reload 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun
SERVICE nginx reload 2>&1 | tee -a ${NM_LOGFOLDER}/cert-renewal.lastrun
echo -e "${idsCL[LightGreen]}The certificates have been renewed.${idsCL[Default]}"
echo
if [ -z $action ] || [ "${action}" = "gui" ]; then
@@ -155,18 +155,18 @@ CERTRENEW(){
fi
}
NIGHTLYRENEW(){
# rm -f ${NM_FOLDER}/cert-renewal.lastrun
# rm -f ${NM_LOGFOLDER}/cert-renewal.lastrun
# ssh root@webserver-node2.scity.us service nginx stop
# sleep 5
$CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge &>> ${NM_FOLDER}/cert-renewal.lastrun
$CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
CONCAT_SSL
chown -R root:le ${NM_CERTPATH} &>> ${NM_FOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} &>> ${NM_FOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
chown -R root:le ${NM_CERTPATH} &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_LOGFOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun
# ssh root@webserver-node2.scity.us service nginx start
SERVICE nginx reload web &>> ${NM_FOLDER}/cert-renewal.lastrun
SERVICE nginx reload web &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
}
CONCAT_SSL(){
@@ -394,9 +394,9 @@ CHECK_NPMCERTS(){
CHECK-CERTS(){
if [ "${1}" == "check" ]; then
rm -f ${NM_FOLDER}/ssl-cert-check.lastrun
${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf > ${NM_FOLDER}/ssl-cert-check.lastrun
SSLLOG="$(cat ${NM_FOLDER}/ssl-cert-check.lastrun)"
rm -f ${NM_LOGFOLDER}/ssl-cert-check.lastrun
${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf > ${NM_LOGFOLDER}/ssl-cert-check.lastrun
SSLLOG="$(cat ${NM_LOGFOLDER}/ssl-cert-check.lastrun)"
SENDNOTICE "SSL Certs Check" "SSL Certs Check\n$SSLLOG"
else
# ${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf

View File

@@ -460,11 +460,11 @@ NEWSITE(){
# fi
fi
rm -f ${NM_FOLDER}/new-site.lastrun
rm -f ${NM_LOGFOLDER}/new-site.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${NEW_SITE}\n${daterun}" > ${NM_FOLDER}/new-site.lastrun
# yes | cp -rfH ${NM_FOLDER}/new-site.lastrun ${NM_NGINXPATH}/new-site.lastrun
# yes | cp -rfH ${NM_FOLDER}/new-site.lastrun /var/www/new-site.lastrun
echo -e "${NEW_SITE}\n${daterun}" > ${NM_LOGFOLDER}/new-site.lastrun
# yes | cp -rfH ${NM_LOGFOLDER}/new-site.lastrun ${NM_NGINXPATH}/new-site.lastrun
# yes | cp -rfH ${NM_LOGFOLDER}/new-site.lastrun /var/www/new-site.lastrun
# daterun=`date +%Y-%m-%d-%H-%M-%S`
# echo -e "${daterun}" >> ${NM_NGINXPATH}/new-site.lastrun
DIVIDER true

View File

@@ -38,7 +38,7 @@ BACKUP(){
echo -e "${idsCL[Yellow]}Not found${idsCL[Default]}"
fi
done
touch ${NM_FOLDER}/backup.lastrun
touch ${NM_LOGFOLDER}/backup.lastrun
# if [ "${action}" != "backup" ]; then
echo
DIVIDER true
@@ -822,17 +822,17 @@ GUI(){
echo -e "\n\n$(date) - Finished status check #############################\n" >> ${NM_TMPFOLDER}/status-check.running
echo "$(date) - LOCAL - ${NODE_HOSTNAME} - Completed Status Check" >> ${NM_LOGFILE}
rm -f ${NM_FOLDER}/status-check.lastrun
mv ${NM_TMPFOLDER}/status-check.running ${NM_FOLDER}/status-check.lastrun
rm -f ${NM_LOGFOLDER}/status-check.lastrun
mv ${NM_TMPFOLDER}/status-check.running ${NM_LOGFOLDER}/status-check.lastrun
# end_status=`date +%s`
# runtime_status=$((end_status-start_status))
# echo -e "\nRuntime: ${runtime_status}" >> ${NM_FOLDER}/status-check.lastrun
# echo -e "\nRuntime: ${runtime_status}" >> ${NM_LOGFOLDER}/status-check.lastrun
if [ "${3}" == "email" ]; then
echo -e "\n\n" >> ${NM_FOLDER}/status-check.lastrun
DOWNLIST report >> ${NM_FOLDER}/status-check.lastrun
STATUSLOG="$(cat ${NM_FOLDER}/status-check.lastrun)"
echo -e "\n\n" >> ${NM_LOGFOLDER}/status-check.lastrun
DOWNLIST report >> ${NM_LOGFOLDER}/status-check.lastrun
STATUSLOG="$(cat ${NM_LOGFOLDER}/status-check.lastrun)"
SENDNOTICE "Status Report" "Status Report\n${STATUSLOG}"
fi
else
@@ -846,7 +846,7 @@ GUI(){
read -n1 choice
case $choice in
[Ll]) watch -n1 tail -n35 ${NM_TMPFOLDER}/status-check.running; echo;;
[Pp]) echo; cat ${NM_FOLDER}/status-check.lastrun;;
[Pp]) echo; cat ${NM_LOGFOLDER}/status-check.lastrun;;
esac
echo
fi;;