I am running cron with -m off
to stop it sending email and then the -s
option is supposed to send all output to syslog.
Cron cmdline is
crond -s -m off
My cron job for testing this is
* * * * * root /bin/echo hello
What I see in /var/log/cron
is
Jun 17 17:06:01 www08 CROND[4165]: h<FF>
Basically all I get is the first character h
and then <FF>
If I change the cron job to be
* * * * * root /bin/echo world
Then I get the first character w
and then <FF>
Ultimately, what I am after is a way of getting all output from cronjobs logged to syslog so that I can manage them with our log alerting system.
I dont want to modify all the cron jobs as some are put there automatically from rpm packages and others by different departments. I am after a solution that sorts this issue once and for all rather than constantly appending 2>&1 | logger -t myscriptname
to the end of every cron job on 100 machines
Found it. The version that is in centos 6 has a bug that was fixed 4 years ago but hasn't been backported by Redhat.
https://www.fedorahosted.org/cronie/ticket/8
Going to build my own revision.
can you run crond with -x for debugging and see if it helps? I've tried running the same job with same crond option and it works fine for me. I'm using Centos7. Also have you tried using "hello".
The fix has been back-ported now, and is available for CentOS 6 - https://pkgs.org/centos-6/centos-updates-x86_64/cronie-1.4.4-16.el6_8.2.x86_64.rpm.html . Well done Tim for reporting it to Red Hat!