I get cron failure emails after switching Ngnix to Apache

Hi guys.

My domain is: mail.formaretech, mail.formareassociados, postfixadmin.formaretech

My web server is (include version):
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2022-04-26T18:02:11

The operating system my web server runs on is (include version):
Ubuntu 20.04.4 LTS
Kernel: Linux 5.11.0-1022-aws
Architecture: x86-64

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
certbot 0.40.0

i recently switched from nginx to apache2 in ubuntu 20.04 and generated new certbot certificates for apache2.
then i stopped the nginx service and later it was uninstalled from ubuntu.
certificates are working fine with apache
by mistake I ran the command 'sudo systemctl restart nginx' and now I get an email every day saying that it was not possible to renew the certificate with nginx
I looked at all cron related files but I can't find where to disable these emails.
the email received looks like this
from: root@formaretech
Subject: Cron root@mail certbot renew --quiet && systemctl reload postfix dovecot nginx
message: Failed to reload nginx.service: Unit nginx.service is masked.

can someone help me please?

Change your cronjob entry so it doesn't try to reload nginx, but Apache?

5 Likes
sudo bash
crontab -e

then, as @Osiris said, change the following:

- certbot renew --quiet && systemctl reload postfix dovecot nginx
+ certbot renew --quiet && systemctl reload postfix dovecot apache

you probably want it to be apache2

3 Likes

Also, just for future reference in your profession or hobbyist in IT: it's probably not a good idea to try to "disable these emails" if you get failures and/or warnings. Maybe it's a language barrier thing, but my advice is to understand what the email is saying first and then try to fix the issue the email is warning you about. Don't have the goal just to silence an annoying email. Set the goal to fix the underlying problem.

5 Likes

Yes, that's it

worked perfectly. thank you so much

1 Like

yes, I just wanted a way to correct it. thank you so much

1 Like