disabling crontab mail notifications

stewie3112

New Member
Sep 9, 2020
7
0
1
36
Hi everyone,

about a month ago I wrote 2 crontab entries to run every 30 seconds (used to upload some data). Everything worked fine, until yesterday I opened my spam mail folder and found more than 86,400 mails (XD). every time the cron service runs an email regarding the job is sent, and this behaviour is definitely not good for me. I tried to redirect the output to /dev/null as suggested in another thread, with no result (emails still sent).

I'd like to disable the notifications for cron or, if not possible to retain for the other services, disabling them completely.

Thanks
Stefano
 
I tried to redirect the output to /dev/null
This is the usual workaround for these cases - could you post the crontab entry that is causing the mails?
(you might need to also redirect stderr to stdout - `> /dev/null 2>&1` )

I hope this helps
 
  • Like
Reactions: stewie3112
Thanks Ivanov, this seems to have fixed the problem. Anyway where can I find the email configuration settings?
 
Anyway where can I find the email configuration settings?

PVE is based on Debian - meaning you can configure your e-mail-service as you would on any debian system (there's tons of guides out there).
PVE by default (with the ISO) installs postfix and configures it for direct mailing.
Regarding the target-address for notification mails (the ones the get sent to the root user of your PVE-instance) - these get forwarded to the e-mail address configured for the 'root@pam' user (in Datacenter->Permissions->Users) .

Regarding mails from cron - this is configurable via the MAILTO parameter in the respective crontab - check `man 5 crontab`

I hope this helps!
 
try add to crontab

>/dev/null 2>&1

Example:
Code:
0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot renew >/dev/null 2>&1
 
  • Like
Reactions: stewie3112
PVE is based on Debian - meaning you can configure your e-mail-service as you would on any debian system (there's tons of guides out there).
PVE by default (with the ISO) installs postfix and configures it for direct mailing.
Regarding the target-address for notification mails (the ones the get sent to the root user of your PVE-instance) - these get forwarded to the e-mail address configured for the 'root@pam' user (in Datacenter->Permissions->Users) .

Regarding mails from cron - this is configurable via the MAILTO parameter in the respective crontab - check `man 5 crontab`

I hope this helps!

Thanks for the hints, I never managed postfix, something new to learn!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!