How can I cron Let's Encrypt certificate renewal?

Christos Hayward asked:

At present, letsencrypt-auto, when run from the command line with e.g. -d example.com -d www.example.com for arguments, requests interactively whether I want HTTP requests forcibly redirected to HTTPS.

How can I cron this? Can I run it < input.txt or some form of yes 2 |? Or does letsencrypt-auto act differently when it’s not attached to a tty?

Thanks,

My answer:


First, update to the latest version of certbot. If you are still calling letsencrypt-auto then you likely have a very old version that will stop working sooner or later.

All you need to do to renew is call certbot-auto renew or certbot renew. Each cert you have obtained already has its own configuration file stored in /etc/letsencrypt and doesn’t need options explicitly specified again.

Ideally you should be using a certbot package provided by your Linux distribution. In addition to remaining up to date, these include a systemd timer which you can enable to have the renewal job run automatically.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.