Cron Nginx Reload


My domain is:

My web server is (include version):The operating system my web server runs on is (include version): Ubuntu 18.04.1

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): 0.28.0

I am trying to reload nginx after I load a new certificate but it doesnt seem to work in my /etc/cron.d/certbot I have the following:
0 */12 * * * root test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e ‘sleep int(rand(43200))’ && certbot -q renew --renew-hook “service nginx reload”

If I run certbot -q renew --renew-hook “service nginx reload” from the terminal manually it works. Am I missing something simple here?


The issue is that the cron job doesn’t do anything on OSes using systemd, like Ubuntu 18.04.

I’d suggest putting service nginx reload (or systemctl reload nginx) in a shell script in /etc/letsencrypt/renewal-hooks/deploy/. Then it will automatically run with certbot renew without having to change the command line.

You can modify or disable the systemd timer, but I think that’s more of a hassle because it might be replaced next time the package is upgraded.


Ill give that a shot. Thanks

closed #4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.