Professional Web Applications Themes

How to set email address for cron? - Ubuntu

Cron is generating some messages on my Ubuntu system. However, the messages are always mailed to root@domain. I have set domain in my postfix configuration. Is there a way to tell cron where to send the messages instead? Sebastian...

  1. #1

    Default How to set email address for cron?

    Cron is generating some messages on my Ubuntu system. However, the messages are
    always mailed to root@domain. I have set domain in my postfix configuration. Is
    there a way to tell cron where to send the messages instead?

    Sebastian
    Sebastian Stein Guest

  2. #2

    Default Re: How to set email address for cron?

    This is quoting Seth Holmes from a previous thread in this newsgroup. "


    You should allow yourself as a user of cron and run it as yourself. It will
    e-mail alerts to the user account. If you want those alerts sent elsewhere,
    you can set up an aliase in /etc/mail/aliases (or /etc/aliases depending on
    your configuration). You could also set up the root account to do this with
    by sending all root e-mail to you. But doing things as root when not
    required as a "Bad Thing(tm)".

    In addition, if you have a specific job you are running and you want the
    output sent to a specific e-mail, you can pipe it through mailx and have it
    sent to you.

    0 7 * * * ls -laR / | mailx -s "Your directory tree" [email]address@domain.com[/email]

    And for real simplification, you can use the MAILTO environment variable.

    MAILTO=address@domain.com

    This will mail on cron output to [email]address@domain.com[/email]. This goes in the
    crontab file (which you edit with crontab -e).

    This can all be found in the crontab man pages. Just some of it is in in
    page 5 so you'd have to do

    man 5 crontab

    HTH
    HAND

    -- Seth H Holmes
    "




    Jeff Thompson

    Jeffery Michael Thompson Guest

  3. #3

    Default Re: How to set email address for cron?

    Jeffery Michael Thompson <ninthwave@atspeakeasy.dotnetnospam> wrote:
    > You should allow yourself as a user of cron and run it as yourself. It will
    > e-mail alerts to the user account. If you want those alerts sent elsewhere,
    > you can set up an aliase in /etc/mail/aliases (or /etc/aliases depending on
    > your configuration).
    Tried this. In /etc/aliases I have

    root: admin@localhost

    and admin is the account I'm working with.
    > You could also set up the root account to do this with by sending all root
    > e-mail to you. But doing things as root when not required as a "Bad
    > Thing(tm)".
    Yes, I didn't do this.
    > In addition, if you have a specific job you are running and you want the
    > output sent to a specific e-mail, you can pipe it through mailx and have it
    > sent to you.
    >
    > 0 7 * * * ls -laR / | mailx -s "Your directory tree" [email]address@domain.com[/email]
    >
    > And for real simplification, you can use the MAILTO environment variable.
    >
    > MAILTO=address@domain.com
    In /etc/cron.daily/aide I have:

    MAILTO="${MAILTO:-admin@localhost}"

    Still, it doesn't work.

    Sebastian
    Sebastian Stein Guest

  4. #4

    Default Re: How to set email address for cron?

    On 2006-02-10, Sebastian Stein <seb_stein@gmx.de> wrote:
    >> MAILTO=address@domain.com
    >
    > In /etc/cron.daily/aide I have:
    >
    > MAILTO="${MAILTO:-admin@localhost}"
    >
    > Still, it doesn't work.
    You have to add it to the crontab file.

    crontab -e

    That will allow you to edit the crontab file.

    --
    Seth H Holmes
    Seth H Holmes Guest

  5. #5

    Default Re: How to set email address for cron?

    Seth H Holmes <sholmes@nottellingyouthiseither.com> wrote:
    > On 2006-02-10, Sebastian Stein <seb_stein@gmx.de> wrote:
    >
    >>> MAILTO=address@domain.com
    >>
    >> In /etc/cron.daily/aide I have:
    >>
    >> MAILTO="${MAILTO:-admin@localhost}"
    >>
    >> Still, it doesn't work.
    >
    > You have to add it to the crontab file.
    >
    > crontab -e
    >
    > That will allow you to edit the crontab file.
    It still doesn't work. It is really driving me crazy. Please also note that the
    cron job for aide is started automatically by the system. The aide script is
    put into /etc/cron.daily/. This time I added MAILTO=admin@localhost to
    /etc/crontab. Still nothing changed.


    Sebastian
    Sebastian Stein Guest

  6. #6

    Default Re: How to set email address for cron?

    On 2006-02-14, Sebastian Stein <seb_stein@gmx.de> wrote:
    > Seth H Holmes <sholmes@nottellingyouthiseither.com> wrote:
    >> On 2006-02-10, Sebastian Stein <seb_stein@gmx.de> wrote:
    >>
    >>>> MAILTO=address@domain.com
    >>>
    >>> In /etc/cron.daily/aide I have:
    >>>
    >>> MAILTO="${MAILTO:-admin@localhost}"
    >>>
    >>> Still, it doesn't work.
    >>
    >> You have to add it to the crontab file.
    >>
    >> crontab -e
    >>
    >> That will allow you to edit the crontab file.
    >
    > It still doesn't work. It is really driving me crazy. Please also note that the
    > cron job for aide is started automatically by the system. The aide script is
    > put into /etc/cron.daily/. This time I added MAILTO=admin@localhost to
    > /etc/crontab. Still nothing changed.
    Where does mail for admin@localhost get delivered? Consider removing
    @localhost.

    --
    Seth H Holmes
    Seth H Holmes Guest

  7. #7

    Default Re: How to set email address for cron?

    Seth H Holmes <sholmes@nottellingyouthiseither.com> wrote:
    >> It still doesn't work. It is really driving me crazy. Please also note that the
    >> cron job for aide is started automatically by the system. The aide script is
    >> put into /etc/cron.daily/. This time I added MAILTO=admin@localhost to
    >> /etc/crontab. Still nothing changed.
    >
    > Where does mail for admin@localhost get delivered? Consider removing
    > @localhost.
    To the admin user's mailbox. For example, I'm as user admin send an email to
    admin@localhost using mutt. Immediately after sending I receive this email in
    my inbox. I already checked this several times.

    Maybe I should contact the author of the aide Ubuntu package. How can I find
    out who prepared the package?

    Sebastian
    Sebastian Stein Guest

  8. #8

    Default How to set email address for cron?

    Just figured it out!!! -- for me at least

    the file /etc/mailname had a single entry (the machine name)
    I have replaced that with my domain name (i.e. mydomain.com) - all is now working

    I hope that info helps someone else out there
    Unregistered Guest

Similar Threads

  1. Email address in a form
    By TrickyTiger in forum Macromedia Dynamic HTML
    Replies: 4
    Last Post: December 16th, 06:29 AM
  2. email address??
    By RichyMan in forum Macromedia Dynamic HTML
    Replies: 7
    Last Post: August 2nd, 04:29 PM
  3. Hiding Email address
    By me in forum ASP.NET Building Controls
    Replies: 1
    Last Post: April 4th, 07:32 AM
  4. email - reply address
    By CLG in forum Windows Server
    Replies: 3
    Last Post: August 28th, 04:41 PM
  5. Getting email address.
    By Sailor in forum Microsoft Access
    Replies: 0
    Last Post: August 3rd, 11:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139