Ask Your Question
0

cron job output no longer in systemd journal (or sSMTP barges in)

asked 2014-04-26 19:00:51 -0500

pgueckel gravatar image

updated 2014-04-27 01:00:07 -0500

In Fedora 20, we no longer have an MTA, such as sendmail. Yay!

I have been running a nightly backup script as a user cron job. Everything has been going fine, until last night, when I noticed that the backup script is still running fine, but that there is now a dead.letter file (owned by mail:me) in my home directory.

I recall that shortly after installing Fedora 20 a few months ago, I checked the systemd journal and the cron messages were showing up there. I assumed that this was the default and this is what I want. I just checked the journal and it now shows:

Apr 26 17:15:12 desk.home sSMTP[18062]: Unable to locate mail
Apr 26 17:15:12 desk.home sSMTP[18062]: Cannot open mail:25
Apr 26 17:15:12 desk.home CROND[18058]: (me) MAIL (mailed 613 bytes of output but got status 0x0001

Why is this suddenly happening? How can I go back to the former behaviour?

edit retag flag offensive close merge delete

Comments

Thanks to both of you!

pgueckel gravatar imagepgueckel ( 2014-04-27 00:48:10 -0500 )edit

Sure thing; don't forget to upvote the answers and comments you found helpful!

bitwiseoperator gravatar imagebitwiseoperator ( 2014-04-27 15:39:22 -0500 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2014-04-27 00:13:12 -0500

Ahmad Samir gravatar image

As far as I know there no MTA is installed by default now in Fedora. ssmtp was probably pulled as a dependency of a smartmontools update (that was the case on my system). So I can uninstall it but smartmontools will go with it.

What I ended up doing was edit /etc/sysconfig/crond and change the CRONDARGS value to:

CRONDARGS=-s -m off

-s send the job output to the system log

-m off disables sending mail of job output

then restart the crond service with systemctl restart crond.service.

edit flag offensive delete link more

Comments

For what it's worth, after reading your original post I tested adding a MAILTO="" line to /etc/sysconfig/crond (and reverted the changes I did in the CRONDARGS line) but that didn't seem to work.

Ahmad Samir gravatar imageAhmad Samir ( 2014-04-27 00:14:49 -0500 )edit

I erased ssmtp and smartmontools (I don't use either). I also edited /etc/sysconfig/crond and now the output shows up in the systemd journal and there is no more ~/dead.letter. I am not sure if the last step is essential, but it is all back to how I want it.

pgueckel gravatar imagepgueckel ( 2014-04-27 00:53:59 -0500 )edit
0

answered 2014-04-26 22:01:04 -0500

updated 2014-04-26 22:03:34 -0500

So your title is a little misleading since you're not asking about how to redirect cron job output to the systemd journal, but rather how to resolve a problem which seems to manifest in the journal as an sSMTP issue. For that, we'll need more information. What is in the dead.letter file? Is it a message your cron job is generating and attempting to send under some circumstance(s)? You say the job is running well, so I suspect it is not an error message.

Anyway, what I would try is installing tcpdump (you can get it from the Fedora repositories, just use "sudo yum install tcpdump"). Scan for interfaces on your machine available to monitor (sudo tcpdump -D), choose the appropriate interface and monitor port 25 to watch the SMTP conversation (sudo tcpdump -i p20p1 -A port 25). The error reported by the mailhub you are using will likely tell you exactly what's going wrong.

Let me know how it goes; if you post any of the output you generate, be very careful not to include any identifying information.

P.S. You should check your /etc/ssmtp/ssmtp.conf file and make sure your authentication information and mailhub information is still valid.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-26 19:00:51 -0500

Seen: 1,611 times

Last updated: Apr 27 '14