Re: Logwatch cron job

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 5/8/20 8:23 AM, Robert Moskowitz wrote:
This is a little more challenging when you don't have a mailer.  I see it ran:

May  8 03:01:02 lx140e anacron[66134]: Anacron started on 2020-05-08
May  8 03:01:02 lx140e anacron[66134]: Will run job `cron.daily' in 26 min.
May  8 03:01:02 lx140e anacron[66134]: Jobs will be executed sequentially
May  8 03:01:02 lx140e run-parts[66123]: (/etc/cron.hourly) finished 0anacron
May  8 03:27:02 lx140e anacron[66134]: Job `cron.daily' started
May  8 03:27:02 lx140e run-parts[66530]: (/etc/cron.daily) starting 0logwatch May  8 03:27:17 lx140e run-parts[66530]: (/etc/cron.daily) finished 0logwatch May  8 03:27:17 lx140e anacron[66134]: Job `cron.daily' terminated (produced output)
May  8 03:27:17 lx140e anacron[66134]: Normal exit (1 job run)

but no /var/spool/mail/root

So a little digging and I find in /usr/share/logwatch/default.conf/logwatch.conf

# By default we assume that all Unix systems have sendmail or a sendmail-like MTA.
# The mailer code prints a header with To: From: and Subject:.
# At this point you can change the mailer to anything that can handle this output
# stream.
# TODO test variables in the mailer string to see if the To/From/Subject can be set # From here with out breaking anything. This would allow mail/mailx/nail etc..... -mgt
mailer = "/usr/sbin/sendmail -t"

So it looks like I need to modify /etc/logwatch/conf/logwatch.conf with

mailer = "/usr/local/mycron"

And see what happens next.

# cat /etc/logwatch/conf/logwatch.conf
# Local configuration options go here (defaults are in /usr/share/logwatch/default.conf/logwatch.conf)
mailer = "/usr/local/mycron"

# cat /usr/local/mycron
#!/bin/sh

currentDate="$(date +'%a %b %d %T %Y')"
echo "From cron@localhost  $currentDate" >> /var/spool/mail/$USER
(cat; echo) >> /var/spool/mail/$USER


What happens after I made this change and then "systemctl restart logwatch"

was for logwatch to send its output to /var/log/messages

So what am I missing?

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux