1

Topic: bash script for "/usr/bin/sys" in /etc/letsencrypt/renewal-hooks/post

Hi iRedmail team,

For let's encrypt cert renewal, I see there is a service "service certbot status" and I also see a folder "/etc/letsencrypt/renewal-hooks/post" which is empty after fresh iRedMail-1.7.2 install.

Also I see this line "1 3 * * * certbot certificates; certbot renew --post-hook 'ln -sf /etc/letsencrypt/live/<domain>/privkey.pem /etc/ssl/private/iRedMail.key; /usr/bin/systemctl restart postfix dovecot nginx' " in "https://docs.iredmail.org/letsencrypt.html".

Question:
Instead of setting up a cron job, is it possible to setup a bash script in "/etc/letsencrypt/renewal-hooks/post" as below?

#!/bin/bash
/usr/bin/systemctl restart postfix dovecot nginx

I believe this will work as post-hook to restart "postfix dovecot nginx" after certificate renew.

Anyone tried this and worked or should we still use the CRON as in the "https://docs.iredmail.org/letsencrypt.html"?

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): iRedMail-1.7.2
- Deployed with iRedMail Easy or the downloadable installer? - Downloadable installer
- Linux/BSD distribution name and version: Ubuntu 24.04.2 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No, iRedAdmin (none-pro)
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: bash script for "/usr/bin/sys" in /etc/letsencrypt/renewal-hooks/post

It should work as it's mentioned on official doc:
https://eff-certbot.readthedocs.io/en/latest/using.html

3

Re: bash script for "/usr/bin/sys" in /etc/letsencrypt/renewal-hooks/post

Hi Zhang,

Thank you for the reply.

I set it up now as per this - https://eff-certbot.readthedocs.io/en/l … -renewals.

I believe we should update this doc - https://docs.iredmail.org/letsencrypt.html
I understand if we setup another cron job, certbot sill works properly according to their documentations,

ZhangHuangbin wrote:

It should work as it's mentioned on official doc:
https://eff-certbot.readthedocs.io/en/latest/using.html