6

Is it possible to tell certbot not to email me every day when running on cronjob?

My cronjob is:

0 0 * * * sudo /usr/bin/certbot renew --post-hook "sudo service nginx reload"

And I get emails:

Cert not yet due for renewal

I only want to get emailed when a certificate is up for renewal, failed to renew, or has been renewed.

I don't need to be notified daily that there is nothing to renew.

John
  • 1,243
  • 4
  • 15
  • 34

2 Answers2

5

According to the Certbot user guide, if you only wanted to be informed of renewal failures then you could add the --quiet option to your command:

certbot renew --quiet --post-hook "sudo service nginx reload"

If you only want to suppress this one particular message then you could modify your command to use grep to discard the message, something like:

certbot renew --post-hook "sudo service nginx reload" | grep -v "not yet due for renewal"
ottomeister
  • 5,415
  • 2
  • 23
  • 27
-1

As far as I know certbot never sends any emails, it's just a command line utility. It's letsencrypt.org who sends certificate expiration notice. But it only sends email when the certificate is about to expire for a domain whose certificate was procured using your email (by --email flag of certbot).

I assume there is some other custom service or script which is sending this email.

Yogeshwar Singh
  • 1,245
  • 1
  • 10
  • 22
  • 2
    The emails are being sent by the `cron` service. `cron` runs commands according to a specified schedule on behalf of users. This is why the OP mentions "cronjobs"; he has arranged for `cron` to run the `certbot` command every day at midnight. If the execution of a scheduled command produces output, the `cron` service collects that output and emails it to the job's owner. – ottomeister Feb 21 '20 at 03:38
  • 1
    Oh! cool. I didn't knew that cron jobs can send status emails, I haven't used them much. I also didn't knew about the ```--quiet``` flag. You learn something new everyday... :) – Yogeshwar Singh Feb 25 '20 at 16:04