Saturday, October 9, 2021

Automatic renew letsencrypt SSL certificate every 3 months

1. Create a simple script to renew and restart Apache httpd server:

[user@scripts]# cat renew-easy-certificates.sh


certbot certonly --webroot -w /var/www/html/easybiny/price -d price.easybiny.com
certbot certonly --webroot -w /var/www/html/easybiny/prod -d easybiny.com
service httpd restart

 

2. Open crontab scheduler

crontab -e 

 

3. Add the following under crontab scheduler:

0 0 1 */3 * sh /path/scripts/renew-easy-certificates.sh

This runs every 3 months on the first day of each month at 00:00. Certificates are now automatically renewed.

No comments:

Post a Comment