Désactiver les courriels quotidiens de cron lorsque le certificat est tout à fait correct

Tradiut avec deepl

Comment puis-je désactiver les messages Cron <root@Yunohost> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) entrant dans ma boîte de réception si le message contient:

/etc/cron.daily/yunohost-certificate-renew:
No certificate needs to be renewed.
3 Likes

I have this issue too.
The mail is not send by yunohost but by anacron.
Anacron send mail only if it has some text when calling scripts.
My solution is to edit the file /etc/cron.daily/yunohost-certificate-renew like that:

#!/bin/bash
message=$(yunohost domain cert-renew --email)
nothing="No certificate needs to be renewed"
if [[ $message != *"$nothing"* ]]; then
        echo "$message"
fi

ie: I catch the output in message variable and test it if it contains the sentence. I return the output if not.
I don’t know yet if it really works (I’ll see tomorow ^^) but that seems logic :wink:

edit: it works

2 Likes

Cela ne fonctionne pas pour moi.
Bien qu’il ait ajouté --no-checks
Je ne sais pas si c’est important.

...
message=$(yunohost domain cert-renew --email --no-checks)
...