Managing cron and similar E-Mails from headless systems

W Scott Lockwood III vladinator at gmail.com
Fri Feb 17 12:50:25 UTC 2017


On Feb 17, 2017 06:39, "Chris Green" <cl at isbd.net> wrote:

On Fri, Feb 17, 2017 at 06:24:10AM -0600, W Scott Lockwood III wrote:
>    On Feb 17, 2017 06:14, "Chris Green" <[1]cl at isbd.net> wrote:
>
>      No use, I want an *ordinary* cron job to identify itself.
>      E.g. I have backup jobs running on one of my headless computers with
>      cron entries like:-
>          20 1 * * * rsync -a --exclude '*.pyc' /home/chris/
>      isbd.uk:.syncmisc/odin/
>      When something goes wrong I want to be able to identify where the
>      mail
>      from cron came from.
>
>    Wrap that cron in a script. Have the script echo the identifier of your
>    choice before it does anything else.
>    echo "This cron is running on Fred, the RPI system providing DNS and
>    DHCP. It lives under your couch."
>    Or something similar.
>
I suppose one could do that, but I don't want E-Mails *except* when
there's an error which would make the wrapper script rather
complicated.

Surely this is a fairly common problem and there must be a reasonably
simple solution.


 But your example cron will send an email with every run as it is now. A
wrapper script is no different, except you can further refine it by adding
logic to also handle sending email only if there is an error. cron does not
do this at all. Yes, you are going to have to write code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20170217/e4a032d2/attachment.html>


More information about the ubuntu-users mailing list