Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2006
    Location
    Jacksonville, FL
    Posts
    498

    Stop Crontab emails

    Hey guys,

    I had PSM do some work on my server and set up a few things. Thing is, now I am getting nightly emails when my server crontabs runs. I asked them to turn them off, but they say that I can't turn off only some of the crontab emails-- they say it's all or none. I need some crontab emails to be sent to me, like rkhunter, logrotate, etc-- I just don't want the ones that tell me the crontab for my backup, update, etc has run. I'm pretty sure that this is possible, but I myself, am not sure.


    Anyone know?


    Kyle

  2. #2
    Join Date
    Jul 2005
    Location
    New Jersey, US
    Posts
    1,507
    Before anyone gets the wrong idea, please clarify your post.

    We never said that you couldn't disable certain cron "outputs". What we said is that the "cron run notifications" itself (the one with the subject "Cron [root@....]" ) for any particular user all must go to one place. For example, if you have cron run notifications for user 'root' set to go to [email protected]', then all crons run by user 'root' will send a notification to [email protected]'

    The actual "output" of any process can be enabled/disabled on a per entry basis, but you will still get a notification that it has been run.

    So you can set any of the root's crons to suppress the output, but you will still get a notification (with a blank ouput) saying that it has been run.

    You cannot selectively have the cron run notifications emails within a users cron file. For example, if the root cron file has 10 crons in it, you can't say you only want 5 of them to send you a notification, and the other 5 of them to not send you any notification.

    Again, I am not referring to the output of the cron. The output of the cron can selectively be suppressed.
    PlatinumServerManagement (also known as PSM)
    The OLDEST and LARGEST and MOST TRUSTED server management provider in the USA, with 15+ employees and growing!
    Providing quality support for OVER 18 years! Currently supporting over 3,000+ servers monthly!

    www.PlatinumServerManagement.com Proud member of the NJ BBB & Chamber of Commerce & Authorized cPanel Partner.

  3. #3
    Join Date
    Apr 2004
    Location
    San Jose
    Posts
    902
    It sounds like Kyle would prefer that just certain cron jobs have output, which would cause cron to send mail with the output. You could do that with something like this:

    4 1 * * * rkhunter ; echo rkhunter result: $?
    Specializing in MySQL and website tuning for high traffic sites. cmwsci.com/

  4. #4
    Join Date
    Oct 2004
    Location
    India
    Posts
    491
    To disable the crontab notification mails, you need to edit the /etc/crontab and edit the
    MAILTO=root
    to
    MAILTO=

    To get a detailed rkhunter report and/or warning messages ( if any ) when the rkhunter is run create a file with +x permission in the /etc/cron.daily named "rkhunter.sh" and add the following in it.
    Code:
    #!/bin/bash
    (/usr/local/bin/rkhunter --update && /usr/local/bin/rkhunter -c --cronjob 2>&1 | mail -s "RKhunter Scan Details" [email protected])
    You can see that the above cron updated the rkhunter db daily and scans and then sends the output/warning to you.

    Similarly, you can check the other crons that you want the notifications to be sent to you and add your mail id there as we have already set the default notification disabled.
    ESC :wq!

  5. #5
    Join Date
    Jul 2005
    Location
    New Jersey, US
    Posts
    1,507
    In our response to him as well as our response here, we did say that the cron 'outputs' can be turned on or off on a per cron process basis. However, the issue was with the cron 'run' notifications, the ones that are controlled by the MAILTO= line. We said that can be either on or off for a user, and effects all the cron processes in that user's cron file.

    So as in my example, if there are 10 cron processes in the root cron file, the MAILTO can either be turned On or Off. If it is Off, then no cron 'run' notifications for that user will be sent. If it is On, then all cron 'run' notifications for that user will be sent.

    Then, on a per cron basis, the actual 'output' of the cron process can be turned on or off (by piping to mail).

    We already gave these options to Kyle, and in our first reply here.
    PlatinumServerManagement (also known as PSM)
    The OLDEST and LARGEST and MOST TRUSTED server management provider in the USA, with 15+ employees and growing!
    Providing quality support for OVER 18 years! Currently supporting over 3,000+ servers monthly!

    www.PlatinumServerManagement.com Proud member of the NJ BBB & Chamber of Commerce & Authorized cPanel Partner.

  6. #6
    Join Date
    Apr 2006
    Location
    Jacksonville, FL
    Posts
    498
    I never said you diddn't give me options, you guys do good work. I just wanted to get some additional info from others. Diddn't mean to make it sound like you all arn't helpful.


    Kyle

Posting Permissions

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