{{tag>letsencrypt certbot crontab cron}}
====== Running certbot hook scripts ======
Make sure you set the SHELL and PATH variables in crontab:
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
...
Then in the ///etc/letsencrypt/renewal-hooks/deploy// directory put your script which will be automatically executed next time when the certificates are renewed.
Example script:
#!/bin/bash
servers=("apache2" "httpd" "nginx")
for server in "${servers[@]}"; do
if command -v "$server" &> /dev/null; then
systemctl restart "$server"
fi
done
Make sure the script is executable
====== Tested on ======
* certbot version: 4.0.0
* AlmaLinux 9.4 (Seafoam Ocelot)
====== See also ======
====== References ======