Letsencrypt automatic certificate renew

Published by Igor Khrupin on

To make automatic renew you Letsencrypt certificates you need create crontab job.

Here is simple instructions

1. Create /root/certrenew.sh file with content:

#!/bin/bash
PATH=/usr/sbin:/usr/bin:/sbin:/bin
sudo service nginx stop
/home/igor/letsencrypt/letsencrypt-auto renew
service nginx start
exit 0

2. Make it executable `chmod +x /root/certrenew.sh`
3. `sudo crontab -e`
4. Add crontab job. Job for running every day at 3:15AM will be next:

15 3 * * * /root/certrenew.sh >> /var/log/le-renew.log

/var/log/le-renew.log – log file

Let me know better approach in comments.


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.