| Server IP : 104.21.95.231 / Your IP : 104.23.243.226 Web Server : Apache System : Linux vm3310.eosdns.net 4.18.0-553.132.1.el8_10.x86_64 #1 SMP Thu Jun 11 14:27:43 UTC 2026 x86_64 User : carnalmedia ( 1000) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /mojo/ |
Upload File : |
#!/bin/bash
#
# Script: certbot_renew
#
# Usage: certbot_renew now
#
# Description: A tool used to renew Let's Encrypt SSL certificates, using certbot, and open up a ticket if the renewal fails
#
# Author: Keith Muska
#
# Changelog:
# * 01/02/2020: Keith Muska
# - Initial write
# * 01/08/2020: Keith Muska
# - Patched to restart both the Webservers and the Mailservers
# * 01/16/2020: Keith Muska
# - Patched error causing the script to open two tickets upon renewal failure. It will now only open a ticket when the exit status is greater than 0, but no renewal failures occurred. This indicates a larger issue with certbot itself
# * 11.06.2021: Nikita Shchetinin
# - CentOS Stream 8 compatibility
# * 15.09.2021: Nikita Shchetinin
# - Ported Arthur's changes from the CentOS 7 branch
# * 01/20/25: Jerry Golding
# - Replaced restart_services with reload_services as restarts were causing downtime
RENEW() {
server=$(hostname)
/bin/certbot renew --deploy-hook '/usr/local/mojo/bin/reload_services'
ret=$?
failures=$(grep -c \(failure\) /var/log/letsencrypt/letsencrypt.log)
failed_domains=$(grep \(failure\) /var/log/letsencrypt/letsencrypt.log | awk -F\/ '{print $5}' | sed 's;-[0-9]\{4\}$;;g' | xargs | sed 's/ /, /g')
if [ $ret -gt 0 ] && [ $failures -lt 1 ]
then
echo "General certbot error! Opening a ticket for $server..."
curl -d "domain=$server" -X POST https://tech.mojohost.com/KWKhwQVc1e3zlDw5nzcH/EhutlNep5TSsXUML0kj3/RtKNSBhdLVUPLBEZKL2g.php
fi
if [ -n "$failed_domains" ]
then
echo "SSL certificate renewal failed! Opening a ticket for $failed_domains..."
curl -d "domain=$failed_domains" -X POST https://tech.mojohost.com/KWKhwQVc1e3zlDw5nzcH/EhutlNep5TSsXUML0kj3/RtKNSBhdLVUPLBEZKL2g.php
fi
}
HELP () {
echo "A tool used to renew Let's Encrypt SSL certificates, using certbot, and open up a ticket if the renewal fails"
echo "usage: certbot_renew now"
}
if [ "$1" == "now" ]
then
RENEW
else
HELP
fi