cron daemon mail

Hi,

I have 2 FreeBSD 8.2 Servers. Both have a script started by crontab and the result is mailed to me. Why is the sender different?

Code:
1/
sender : Charlie &
Object : Cron <root@mysql1> /root/mbin/portupdater.sh

Code:
2/
Sender : Cron daemon
Object : Cron <root@smtp21> /root/mbin/portupdater.sh

Why one is "Root" and the other one is "Cron"?
 
Standard (and error) output from command run by cron is by default sent as Cron Daemon. If you run the command from cron as root and this command itself sends an email, it will be from Charlie Root.

But assuming that your crontab entries and scripts portupdater.sh are the same on both servers, this is not the case. Is it?

What smtpd do you use on these servers?
 
Also compare the GECOS fields in /etc/passwd on both servers.
 
On both servers, my script is identical and is registered in root's crontab (with crontab -e)
Code:
0 1 * * * /root/mbin/portupdater.sh

There is only this line.

/etc/passwd for root are identical in both servers.

smtp21 sends mail himself, because, it's an smtpd relay (postfix).
mysql1 sends mail to smtp21 (with ssmtp).

It's very "strange". My smtpd relay is a big postfix farm servers. I have mail from smtp11/12/13 and smtp21/22/23. Only smtp21 sends mail from "Cron daemon". Others send with "Charlie Root".
 
k-nike said:
How can I change it? I need to change the name of the sender.

One way is change line

Code:
fprintf(mail, "From: %s (Cron Daemon)\n", usernm);

in /usr/src/usr.sbin/cron/cron/do_command.c and then recompile and reinstall cron.
 
Simply make sure the script doesn't output anything and uses its own mailx(1) command to send an email.
 
pbd said:
One way is change line

Code:
fprintf(mail, "From: %s (Cron Daemon)\n", usernm);

in /usr/src/usr.sbin/cron/cron/do_command.c and then recompile and reinstall cron..

Why then periodic scripts are sent on user behalf?
 
OpenSMTPD appeared in ports today. I have installed it. The Username field in the email changed from "Cron Daemon" to "root".

When I installed ssmtp, the Username field in the email changed from "Cron Daemon" to GECOS field's "root".

Is it a bug or a feature?
 
Back
Top