Getting CRON to send me mail
Results 1 to 5 of 5

Thread: Getting CRON to send me mail

  1. #1
    Member
    Join Date
    Nov 2003
    Posts
    48

    Getting CRON to send me mail

    I would like to have CRON send mail to my internet e-mail address.

    I am using Redhat9.

    The line I have in my /etc/crontab file is:


    MAULTO=cmd | mail -s "cron report" myemail@mindspring.com

    So far it does not appear to be working.

    This is the ONLY crontab file on my machine - i.e. I do not have any specific user crontabs set up that would override this one.

    Any ideas on what I am missing here?

    .: Aftiel

  2. #2
    Member
    Join Date
    Nov 2003
    Posts
    48
    Just as an addendum, I can use the mail command from the command line and send myself mail with no problem, so I know it is working correctly.

    The problem seems to be getting the system to send it to me automatically.

    Ideally, I would like to have my cron reports and logs sent to me via the internet.

    Any guidance as to what I may be missing here is greatly appreciated.

    .: Aftiel

  3. #3
    Senior Member
    Join Date
    Jul 2002
    Location
    Texas
    Posts
    168
    Well from the looks of it you didnt specify it to email you anything...
    You are calling the mail program with the subject and who to send it to, then mail drops into 'interactive' mode and waits for you to enter the body of the text and then tell the mail application that your done...

    Hope this helps you out a bit... Yes i know its vague but im not feeling like looking up the info right now thats for you to do =P
    <chsh> I've read more interesting technical discussion on the wall of a public bathroom than I have at AO at times

  4. #4
    Member
    Join Date
    Nov 2003
    Posts
    48
    Thanks Dark - I have read man pages etc. until my eyes are crossed.

    What you are saying makes sense - my understanding was that by default the MAILTO line in crontab would by default send the cron reports. Meaning that would be the body of the message.

    I will do some more research.

    I appreciate the reply.

    .: Aftiel

  5. #5
    Senior Member
    Join Date
    Mar 2003
    Posts
    245
    Hi Aftiel,

    Baiscally, you want to 'pipe' a command to mail and send it to your email address (as explained by Darksnake).

    A very simple example would be to send the output of df -h to yourself once per day as in this example....


    30 07 * * * /bin/df -h | mail -s "Daily Disk Usage Stats on `uname -n`" your.external@emailaddress.org


    Which in english means at 07:30, run the command 'df -h' and send the output in an email to your.external@emailaddress.org with subject "Daily Disk Usage Stats on [short hostname]"

    Hope that helps...

    -- spurious
    Get OpenSolaris http://www.opensolaris.org/

Posting Permissions

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