You are not logged in.

#1 2012-10-16 00:24:43

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

[solved] problems configuring systemd + crond w/o sendmail

Before switching to systemd, I had crond from cronie configured not to try to use sendmail but to use syslog instead. Since switching to systemd, crond insists on looking for sendmail and fills the logs with errors. After updating the system today, I even got a message prior to login telling me that there was no mail!

[EDIT: I guess the new message is unrelated to this problem and is due to the fact that the pam config for kde is now using redhat's system-login set up. There's a bug for this but I've just commented out the most offending lines for now.]

$ less /etc/systemd/system/cronie.service 
[Unit]
Description=Periodic Command Scheduler

[Service]
EnvironmentFile=-/etc/conf.d/crond
ExecStart=/usr/sbin/crond -n $CRONDARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=always

[Install]
WantedBy=multi-user.target
$ less /etc/conf.d/crond
# Settings for the CRON daemon.
# CRONDARGS= :  any extra command-line startup arguments for crond
CRONDARGS="-s"

And, indeed, a check with ps reveals:

/usr/sbin/crond -n -s

so the config is getting picked up correctly.

Checking the man page for crond:

-s     This option will direct Cron to send the job output to the system log using syslog(3).  This is useful if your system
              does not have sendmail(8), installed or if mail is disabled.

so this is also the correct option to be passing. (Note: this may differ on your system - I believe it depends on which version of cron you have installed.)

For good measure, I also appear to have:

$ less /etc/systemd/system/crond.service 
[Unit]
Description=Periodic Command Scheduler

[Service]
EnvironmentFile=-/etc/conf.d/crond
ExecStart=/usr/sbin/crond -n $CRONDARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=always

[Install]
WantedBy=multi-user.target

systemctl confirms the argument is being passed:

$ systemctl status cronie.service 
cronie.service - Periodic Command Scheduler
          Loaded: loaded (/etc/systemd/system/cronie.service; enabled)
          Active: active (running) since Mon, 15 Oct 2012 23:30:18 +0100; 1h 51min ago
        Main PID: 423 (crond)
          CGroup: name=systemd:/system/cronie.service
                  └ 423 /usr/sbin/crond -n -s

Does anybody know why crond still looks for sendmail and/or how to stop it doing so?

Last edited by cfr (2012-10-18 23:41:55)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#2 2012-10-16 01:22:00

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] problems configuring systemd + crond w/o sendmail

I think because whether or not you choose to have it forwarded to syslog has nothing to do with whether or not it is going to sendmail that sh*t.  So I think what you need to do is add "-m off" to either the $CRONDARGS or simply to the command itself, since you have already copied it to /etc.

Offline

#3 2012-10-16 21:45:53

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [solved] problems configuring systemd + crond w/o sendmail

Trying that now. (I can't believe I missed this in the man page although the description of the -s option does rather suggest you've got the right flag once you've found that one. Plus it worked pre-systemd!)

Thanks!


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#4 2012-10-17 04:49:39

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] problems configuring systemd + crond w/o sendmail

Did you get this working how you would like it?

Offline

#5 2012-10-17 22:51:51

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [solved] problems configuring systemd + crond w/o sendmail

I'm still testing. (I forgot to reload the service.)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#6 2012-10-18 01:26:19

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] problems configuring systemd + crond w/o sendmail

Ha, I do crap like that all the time.  I look at the relevent info and I go "Why the hell is this not working!?!?  Oh, I forgot to do a daemon-reload..."  Then I feel silly.

Offline

#7 2012-10-18 23:42:11

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [solved] problems configuring systemd + crond w/o sendmail

That did the trick - thanks!


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#8 2012-10-19 00:57:53

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] problems configuring systemd + crond w/o sendmail

Glad to hear it.

Offline

Board footer

Powered by FluxBB