Benches / macOS
2
How to stop Crontab execution sending emails
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hello,
1st: System running Leopard Server 10.5.6. (running mainly Web Services)
2nd:
*Cron job execution will send email to local user (owner of cron jobs).*
*Is there a configuration item to stop this behavior...?* (I have searched without any luck).
(I utilize crontab to create the cron jobs).
*I noticed the emails, (21k emails), on the local user after Server stopped responding.*
Since I didn't setup the email service on the server there were multiple lmtp error messages in the syslog file.
Any thoughts...
M
2 replies
Sign in or join Beachball Help to reply.
0
snocountry ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
_*An example of one of the many emails_:*
From [email protected] Wed Mar 31 10:36:59 2010
X-Original-To: xxxx
Delivered-To: [email protected]
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <xxxx@snocountry> /a/path/xxxx/scripts/updateWebInfoTable.pl
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=xxxx>
X-Cron-Env: <USER=xxxx>
X-Cron-Env: <HOME=/Volumes/HD1/xxxx>
Date: Sat, 27 Mar 2010 01:24:02 -0400 (EDT)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 70 0 70 0 0 9784 0 --:--:-- --:--:-- --:--:-- 0
0
snocountry ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Resolved...
Essentially cron will email the user any output sent to stdout.
Which in my case was from a curl command in a perl script.
To disable messages to stdout for curl, I simply added the "-s" silent option to curl command
Previous: $result = `/usr/bin/curl
http://www.url.com/info.php `;
Fix: $result = `/usr/bin/curl -s
http://www.url.com/info.php `;
FYI:
For bash scripts, it should be:
/path/to/command > /dev/null
M