disabling crontab mail notifications

stewie3112

New Member
Sep 9, 2020
7
0
1
34
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
 

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
6,690
992
163
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

stewie3112

New Member
Sep 9, 2020
7
0
1
34
Thanks Ivanov, this seems to have fixed the problem. Anyway where can I find the email configuration settings?
 

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
6,690
992
163
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!
 
  • Like
Reactions: stewie3112

Hollis

Member
Apr 25, 2018
43
8
13
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

stewie3112

New Member
Sep 9, 2020
7
0
1
34
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 your own in 60 seconds.

Buy now!