User Tools

Site Tools


wiki:running_certbot_hook_scripts

Running certbot hook scripts

Make sure you set the SHELL and PATH variables in crontab:

download
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:

download
#!/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

wiki/running_certbot_hook_scripts.txt · Last modified: by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki