Re: Almost working - Re: user crontab

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

 



I have dug a bit into mbox fomat and looked at one system that has some mail in root's mbox.

It SEEMs that what I am missing is a FROM: line at the beginning that mutt can handle.  Perhaps something like:

From cron@localhost  Thu May 07 13:15:01 2020

Note no colon after 'From' and a timestamp

How can I make a command to add to my script to create this? Meanwhile I keep digging.....

thanks

On 5/7/20 1:24 PM, Robert Moskowitz wrote:
First I made a script at /usr/sbin/mycron

#!/bin/sh

(cat; echo) >> /var/spool/mail/$USER


Then I changed cat /etc/sysconfig/crond

# Settings for the CRON daemon.
# CRONDARGS= :  any extra command-line startup arguments for crond
CRONDARGS= -m "/usr/sbin/mycron"

And restarted crond

Next I changed my crontab with:

15 * * * * ls /home/rgm

I know have mail waiting in /var/spool/mail/rgm, but mutt can't process it.  So I am missing something in the format of mail in /var/spool/mail.  Can someone point me to the proper format?

What I have there from the cron of that ls is:

From: "(Cron Daemon)" <rgm>
To: rgm
Subject: Cron <rgm@lx140e> ls /home/rgm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=266>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
X-Cron-Env: <XDG_SESSION_TYPE=unspecified>
X-Cron-Env: <XDG_SESSION_CLASS=background>
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=rgm>
X-Cron-Env: <HOME=/home/rgm>
X-Cron-Env: <LOGNAME=rgm>
X-Cron-Env: <USER=rgm>

arm
bin
data
Desktop
Documents
Downloads
Music
odds
Pictures
Public
r
rcd
Templates
test
tftpboot
uasca
Videos



On 5/7/20 10:04 AM, Robert Moskowitz wrote:


On 5/7/20 9:25 AM, Robert Moskowitz wrote:


On 5/7/20 7:48 AM, Robert Moskowitz wrote:


On 5/6/20 11:34 PM, Cameron Simpson wrote:
On 07May2020 13:19, Cameron Simpson <cs@xxxxxxxxxx> wrote:
On 06May2020 20:20, Robert Moskowitz <rgm@xxxxxxxxxxxxxxx> wrote:
I am reading up on esmtp which comes with the base install and seemingly no mta needed?

Anyway
https://linux.die.net/man/5/esmtprc

shows how to config for sending an email via esmtp to an mta, but not just local delivery...

The bottom of that manual entry describes the "mta" setting, and says that esmtp relies on a local MTA for local delivery (addresses without an "@"). So you'll need something additional anyway. May as well go straight to a proper MTA.

And then, to my chagrin, I reread and see it provides example "mta" values like:

   /usr/bin/procmail -d %T

So you may be good there.

Would first have to install procmail for this.

It would be interesting to find a 'simple' python script to grab the cron output and 'make' an email and appended to the spool/mail

I am finding things about python and email that is leading me down many roads.

First is how does CRON even send emails?  The MAILTO option triggers where to send email, but what is the how?  What is CRON using to grab its output and stuff that into what emailer program?

My digging is that CRON needs some email server installed, like postfix, before it will send emails of its stdout.  But where is this controlled so I can change it?

Ah, looking at man crond.5:

       -m     This  option  allows  you  to specify a shell command to use for               sending Cron mail output instead of using sendmail(8) This  com‐               mand  must  accept a fully formatted mail message (with headers)               on standard input and send it as a mail message to the  recipi‐               ents  specified  in the mail headers.  Specifying the string off
              (i.e., crond -m off) will disable the sending of mail.

So all I need is a script at /usr/bin/mycron

#!/bin/sh

something
something

So what do I put in the -m arg and in mycron so that this output gets appended to /var/spool/mail/MAILTO

?

Thanks
_______________________________________________
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
_______________________________________________
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