There are several ways to use hooks in Certbot
The directory hooks in /etc/letsencrypt/renewal-hooks/{pre,post,deploy}, which will run for every certificate.
Specifying a hook when creating or renewing a specific certificate with --pre-hook, --post-hook and --deploy-hook.
--deploy-hook (and its directory equivalent) receives $RENEWED_LINEAGE as an environment variable, which points to the /etc/letsencrypt/live/example.com directory. You may use $(basename $RENEWED_LINEAGE) to get the certificate name.
--pre-hook and --post-hook do not receive any arguments or environment variables.
Each --pre-hook is executed immediately before the renewal attempt for any certificate which asks for it to run. If multiple certificates have the same --pre-hook, it will only be executed a single time. It is deduplicated.
Each --post-hook are gathered and executed after every certificate renewal attempt has completed. The success or failure of each certificate renewal attempt has no effect on whether the hook runs. As with --pre-hook, they are deduplicated.
Each --deploy-hook is executed immediately after a successful renewal attempt for its respective certificate. It is not executed if the renewal attempt for that certificate fails.
You can also set hooks (and others options if you like) as global options in the file /etc/letsencrypt/cli.ini like this:
renew-hook = service postfix reload
post-hook = service nginx reload
Another method which do not use global configuration - you can find existing renewal configurations and their hooks in this folder /etc/letsencrypt/renewal/:
[renewalparams]
pre_hook = systemctl stop nginx.service
post_hook = systemctl restart nginx.service