Hello
My domain is: jpdn.net
I ran this command (via CRON) in order to auto. to check and renew a specific certificate :
#!/bin/bash
#check and renew certbot cer for mail.xxxx.net
#certbot-renew-mail.sh
certbot certonly --standalone -n -d mail.xxx.net --pre-hook "service apache2 stop" --pre-hook "service postfix stop" --post-hook "service apache2 start" --post-hook "service postfix start" --post-hook "service dovecot restart"
mail -s "[Server] CERTBOT update for mail.xxxx.net" xxxx@xxxx.net < /var/log/letsencrypt/letsencrypt.log
exit 0
sh certbot-renew-mail.sh
produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Cert is due for renewal, auto-renewing…
Running pre-hook command: service postfix stop
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for mail.xxxx.net
The program apache2 (process ID 31832) is already listening on TCP port 443. <----------------------
This will prevent us from binding to that port. Please stop the apache2 program
temporarily and then try again.
Although
pre-hook "service apache2 stop"
is in the script
But when I type directly
service apache2 stop
sh certbot-renew-mail.sh
service apache2 start
All works fine !
Then I’m think about multiple pre hooks :
–pre-hook “service apache2 stop” --pre-hook “service postfix stop"
There is no message for running the pre hook " apache2 stop” (only for postfix)
Is there something wrong on pre hooks comands ?
Should I use another port ?
Any idea ?