Results 1 to 10 of 10
  1. #1
    Full Member c4's Avatar
    Join Date
    January 18th, 2005
    Posts
    488
    I'm using Cron to run a Perl script every minute. The script just logs some information into a database, nothing else. Now the problem is Cron sends an e-mail to my address with the results of every execution of this script (if the script logs words "A, B, C" Cron send these words to my e-mail). I'm pretty sure Cron is sending these messages as the Perl script doesn't use any mail software/send e-mail. Is there a way I can stop Cron from sending me these results (there's a lot of useless mail in my mailbox)?

    Thanks!



    YOURsoft - worlds 1st dealware scripts!
    NEW - Join YOURsoft "affiliate program for affiliate software"!

  2. #2
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    c4,

    cron will, by default, send email to the owner of the job. You can set a MAILTO environment variable in your cron file to change where this goes. Set it to null if you want the output to go to nobody.

    MAILTO=""
    # Minute Hour Day-Of-Month Month Day-Of-Week Command
    1 * * * * /usr/bin/ls

    --scott

    --
    Scott Jangro
    sjangro@befree.com

  3. #3
    Full Member c4's Avatar
    Join Date
    January 18th, 2005
    Posts
    488
    Hello ScotJ,

    Thanks for your reply! The problem is I can issue Cron commands only through Cpanel and I do not have access to the Cron file, I can only ad 1 * * * * and the command to be executed, I can't set the MAILTO="". Thanks anyway, I will talk with my host if they can change this.

    Regards,
    c4



    YOURsoft - worlds 1st dealware scripts!
    NEW - Join YOURsoft "affiliate program for affiliate software"!

  4. #4
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    1,916
    1 * * * * /usr/bin/ls > /dev/null 2>&1

    or something...

    ----
    -J
    Merchants: Do you realize that some of your affiliates are being paid commission on sales which you have paid for via PPC, offline advertising, and your targeted mailings?

  5. #5
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    I may be wrong, but even if you redirect the output of the individual scheduled jobs to /dev/null, the cronjob itself may still send an email.

    --
    scott@befree.com

  6. #6
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    1,916
    Scott,
    Have never seen cron do that. I'd be quite annoyed if I got an email every time one of my cron jobs fired off.

    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>the problem is Cron sends an e-mail to my address with the results of every execution of this script<HR></BLOCKQUOTE>
    Sounds like its mailing him the output of the perl script. Which, is normal behaviour.

    ----
    -J
    Merchants: Do you realize that some of your affiliates are being paid commission on sales which you have paid for via PPC, offline advertising, and your targeted mailings?

  7. #7
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    I get an email three times a day when my three cron entries run because I have the mailto="myemail_address" set.

    It mails me the ouput of the individual script that I have scheduled.

    What I don't know is if I redirect the output of one of the scripts to /dev/null whether I'll still get an empty email. I'm guessing I will.

    --
    scott@befree.com

  8. #8
    Full Member c4's Avatar
    Join Date
    January 18th, 2005
    Posts
    488
    Yes, Joshep, it is mailing me the output of the Perl script - how can I get rid of it (but still run the script as scheduled)?



    YOURsoft - worlds 1st dealware scripts!
    NEW - Join YOURsoft "affiliate program for affiliate software"!

  9. #9
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    1,916
    Scott- Try it. I don't (get an empty email, and I'd expect you won't either). But, then, I don't use MAILTO either....never have...

    c4- I pasted above, just redirect the output of the scripts to a file or to /dev/null. cron just mails you the output from your script, STDOUT and STDERR, I believe, so redirect those somewhere else and it should go away.

    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> current minute. When executing commands, any output is mailed to the us-
    er named in the MAILTO environment variable in the crontab, or to the
    owner of the crontab if MAILTO is not present.<HR></BLOCKQUOTE>

    See: man cron, google cron output (or similar), etc.

    ----
    -J
    Merchants: Do you realize that some of your affiliates are being paid commission on sales which you have paid for via PPC, offline advertising, and your targeted mailings?

  10. #10
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    Tried it and you're right.

    ls -l &gt; /dev/null
    ==&gt; no email

    ls -l
    ==&gt; email

    I didn't try STDERR, just STDOUT.

    [This message was edited by ScottJ on February 04, 2003 at 04:57 PM.]

  11. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Cron job
    By templus in forum ShareASale - SAS
    Replies: 22
    Last Post: July 29th, 2007, 03:50 PM
  2. Cron Jobs
    By Kevin in forum Marketing Resources & Power Tools
    Replies: 3
    Last Post: March 23rd, 2005, 04:17 PM
  3. cron/crontab help
    By Pete in forum Programming / Datafeeds / Tools
    Replies: 6
    Last Post: February 25th, 2002, 07:45 AM

Posting Permissions

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