Auto-renew all certificates on server

We recently moved a bunch of sites to a self-managed server and I used let's encrypt to issue SSL certs to the sites:

I ran these commands to install the certificates initially:

cd /usr/local/letsencrypt
./letsencrypt-auto --apache -d
./letsencrypt-auto --apache -d

My question is what the command would be to automatically renew these certificates with a cron job

My web server is (include version):
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2020-08-12T21:33:25

The operating system my web server runs on is (include version):
#25~18.04.1-Ubuntu SMP Fri Sep 11 12:03:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

My hosting provider, if applicable, is:

  • Self hosted @ AWS

I can login to a root shell on my machine (yes or no, or I don't know):

  • Yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):

  • No.

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

cd /usr/local/letsencrypt
./letsencrypt-auto --version
Your system is not supported by certbot-auto anymore.
Certbot will no longer receive updates.
Please visit to check for other alternatives.
certbot 1.9.0

If you install Certbot from one of the recommended sources, then a scheduled renewal task will be setup automatically for you.

If you want to continue using letsencrypt-auto, then you can setup a cronjob.

e.g. Create /etc/cron.d/letsencrypt-auto with:

0 */12 * * * root perl -e 'sleep int(rand(43200))' && /usr/local/letsencrypt/letsencrypt-auto -q renew
1 Like

Thanks so much! That command did the trick; all sites certificates have been renewed.

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