So Fun. I successfully converted my janky old site from http://tomshiro.org to https://tomshiro.org with y'alls help. I'm very pleased with all of it.
If I read the apache/Debian/pip instructions correctly, I want to check the certificate every 12 hours + (60 minutes % random number) . I wrote a shell script instead of using the suggested crontab entry:
#!/bin/bash
Run certbot for https renewal
Charles Shapiro 2 Jun 2025
/opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && sudo
RESULTS=/tmp/certbot_results$$.txt
DELAY=$(( $RANDOM % 60 ))
sleep ${DELAY}m
certbot renew -q
certbot renew > ${RESULTS} 2>&1
export TZ='America/New York'
{
echo from: root@tomshiro.org
echo to: charles.shapiro@tomshiro.org
echo subject: certbot results
echo
echo Run time: $(date)
echo Results:
cat ${RESULTS}
} | /usr/sbin/sendmail redacted@tomshiro.org
rm ${RESULTS}
And of course my crontab(8) currently reads:
m h dom mon dow command
0 0,12 * * * root/bin/renew_certbot.sh
It seems to work ok fine. The mail I am seeing in my inbox is:
Run time: Thu Jul 24 16:24:22 EDT 2025
Results:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Processing /etc/letsencrypt/renewal/tomshiro.org.conf
Certificate not yet due for renewal
The following certificates are not due for renewal yet:
/etc/letsencrypt/live/tomshiro.org/fullchain.pem expires on 2025-10-16 (skipped)
No renewals were attempted.
My only question is: Can I get away with less than every 12 hours? Maybe once a day or once a week? My cert says it expires in October or so, and from what I'm reading it'll be eligible for renewal in late August. Or is running with an expired cert gonna cause me to, like, drop off the web until it renews?