Shell Script : Let’s Encrypt Auto Renew

Neste post será apresentado apenas o script de renew do Let’s Encrypt.

Basta apenas agendar no crontab .

#!/bin/bash
case $@ in

apache)
if service apache2 status </dev/null 2>&1 | grep -q Escape ; then
sudo /bin/certbot-auto renew | tee /var/log/certbot-renew.log
sudo service apache2 reload
exit 0

else
sudo /bin/certbot-auto renew | tee /var/log/certbot-renew.log
service httpd reload
exit 0

fi
;;

nginx)
sudo /bin/certbot-auto renew >> /var/log/certbot-renew.log
service nginx reload
exit 0
;;