Compare commits

..

No commits in common. "prod" and "v1.1" have entirely different histories.
prod ... v1.1

View file

@ -1,28 +1,10 @@
#! /bin/bash #! /bin/bash
#should probably add logic to only halt/reload once (and only if necessary)
function halt() {
#stop services if necessary
if [ -d /var/lib/ipa/ ]
then
#stop httpd
systemctl stop httpd
fi
}
function reload() { function reload() {
#reload/restart relevant services #reload/restart relevant services
if [ -d /etc/nginx/certs/ ] if [ -d /etc/nginx/certs/ ]
then then
systemctl reload nginx systemctl reload nginx
fi fi
if [ -d /var/lib/ipa/ ]
then
#restart httpd
systemctl start httpd
/scripts/setup-le.sh
systemctl restart httpd
#load cert
fi
} }
dom=`date +%d` dom=`date +%d`
@ -39,9 +21,8 @@ do
if [[ $today > $expires ]] if [[ $today > $expires ]]
then then
echo Certificate for $f is expired, renewing >> $log echo Certificate for $f is expired, renewing >> $log
halt
certbot renew --cert-name $f >> /var/log/certbot-renewal.log certbot renew --cert-name $f >> /var/log/certbot-renewal.log
reload reload()
continue continue
fi fi
#convert hostname into day of month between 0 and 28 to renew on specific day of month (reduce chance of running out of cert renewals) #convert hostname into day of month between 0 and 28 to renew on specific day of month (reduce chance of running out of cert renewals)
@ -53,9 +34,8 @@ do
if [[ $dom -eq $rdate ]] if [[ $dom -eq $rdate ]]
then then
echo Date falls within renewal window for $f, attempting renewal >> $log echo Date falls within renewal window for $f, attempting renewal >> $log
halt
certbot renew --cert-name $f >> $log certbot renew --cert-name $f >> $log
reload reload()
break break
fi fi
done done