WordPress.org

Ready to get started?Download WordPress

Forums

Cron job and wp-mail question - file created on root (9 posts)

  1. c0c0c0
    Member
    Posted 9 years ago #

    Hello!

    I am cool_blade's wp-mail and I have it up and going now. I have a cron job set up to wget wp-mail.php every 15 minutes. Every time it runs it leaves a file on the root of my domain account. I don't want it to do that. my syntax is:

    wget http://whogivesacrap.net/wp-mail.php > /dev/null

    And it still is outputing. Is there a way I can have something like a script get the wp-mail without it outputing a file or is it something that wp-mail needs to be modified to keep it from echoing something back?

    Thanks!

  2. freude
    Member
    Posted 9 years ago #

    I had the same problem and solved it by redirecting stderr as well as stdout to /dev/null:

    wget http://whogivesacrap.net/wp-mail.php > /dev/null 2>&1

    If wp-mail.php finds no email to post it says so using the die function, which is printed to stderr.

  3. c0c0c0
    Member
    Posted 9 years ago #

    I tried that and it is still printing out. Anyway I can comment out the die functions or use something different so it doesn't print anything out?

  4. c0c0c0
    Member
    Posted 9 years ago #

    bump

  5. abier
    Member
    Posted 9 years ago #

    I'm having this same problem. I've tried both:

    wget http://adambier.com/wp-mail.php > /dev/null

    and

    wget http://adambier.com/wp-mail.php > /dev/null 2>&1

    and I still get crap in my root dir every time.

  6. c0c0c0
    Member
    Posted 9 years ago #

    cool_blade?

    Anyone??

  7. c0c0c0
    Member
    Posted 9 years ago #

    I figured it out...

    change line 20 in wp-mail.php to:
    if (0 == $count) die;

  8. lyklev
    Member
    Posted 9 years ago #

    You can also do it without hacking wp-mail.php:


    wget -O /dev/null http://yoursiteetc/wp-mail.php

    (normally, wget outputs to a file, now it outputs to the unix drain)

  9. cosmogrrl
    Member
    Posted 9 years ago #

    Thanks, lyklev! Your information has greatly helped me to set up a cron job that works!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.