On a mail server I need to reload Dovecot after Certbot renews my Let's Encrypt certificates. According to the Certbot documentation a --deploy-hook
can be used:
Command to be run in a shell once for each issued certificate.
I found the cron job that was created automatically at /etc/cron.d/certbot
, and with the help of of certbot and this question I figured I would use:
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew --deploy-hook "service dovecot reload"
The problem is, Docecot does not appear to restart. Certificate renewal is still successful. My question: How to make sure Dovecot is reloaded after certificate renewal?
Addition information: Server runs on Ubuntu 18.04.3 LTS with Certbot 0.31.0.