skip to Main Content

I have a cron every two minutes (*/2 * * * *) firing the following command…

wget "http://www.example.com/wp-cron.php?import_key=my_key_stringimport_id=16&action=trigger"

Trouble is, it is emailing me every two minutes, and also creating copious tiny files on the server, one each time.

I have tried several things. I know there is plenty of info out there about suppressing email feedback from cron.

cPanel’s Cron page, where my crons are set, makes clear: “If you do not want an email to be sent for an individual cron job, you can redirect the command’s output to /dev/null. For example: mycommand >/dev/null 2>&1

But when I did it like this…

wget -O "http://www.example.com/wp-cron.php?import_key=my_key_stringimport_id=16&action=trigger" >/dev/null 2>&1

… the cron stopped functioning.

(I believed an -O was necessarily to direct the output).

What is the proper way to formulate this?

2

Answers


  1. Chosen as BEST ANSWER

    This seems to do the trick...

    wget --quiet -O "http://www.example.com/wp-cron.php?import_key=my_key_stringimport_id=16&action=trigger"
    

    Ie. Add --quiet

    Answer found elsewhere on Stackoverflow.

    Bit confused how --quiet and -O co-exist.


  2. To suppress mails from cron you can add before your line in cron MAILTO

    MAILTO=""
    */2 * * * * command
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search