Cron Email Output from wget

Cron Email Output from wget

Posted by: Mothman
Posted on: 2009-09-18 10:15:00

Hello,

I successfully set up my cron job. I went for :
* * * * * wget -q --delete-after http://yourdomain.com/path-to-php-script.php

Because when using:
* * * * * /dh/cgi-system/php5.cgi /home/youruser/yourdomain.com/path-to-php5-script.php
The script couldn't connect to MySQL.

However in the email response from the cron I wanted to get the output of the script. This was working with CGI but not wget. Is there any way to do it? I tried removing the -q param, but that just sends the http connection process details.

Thanks a lot!

Re: Cron Email Output from wget

Posted by: Atropos7
Posted on: 2009-09-18 13:02:00

Documentation on many commands and programs is available from the shell or a search engine query like "man [command]"

http://linux.die.net/man/1/wget

In this case you'll want to use -O,the option for printing the content to a file, in order to get the contents printed to standard output. Or if you are saving the contents to file anyways just a 'cat' command to print the saved file.


Customer since 2000 cool openvein.org

Re: Cron Email Output from wget

Posted by: Mothman
Posted on: 2009-09-19 05:17:00

Thanks a lot for that link Atropos, I never used wget before so it's very useful :-)

To confirm, the correct cron to get wget output sent to email (and not saved as file) is:
* * * * * wget -O - http://yourdomain.com/path-to-php-script.php
?

I just saw in the Wiki (http://wiki.dreamhost.com/index.php/Cron#Executing_a_PHP_Script_with_Crontabs) this one:
* * * * * links -dump http://yourdomain.com/path-to-php-script.php

I'm assuming this is an alternative that does the same thing?

Thanks again

Re: Cron Email Output from wget

Posted by: sXi
Posted on: 2009-09-19 08:23:00

In reply to:

I'm assuming this is an alternative that does the same thing?


The Wiki says it does. Please let us know if you try it and it works for you!




How To Install PHP.INI / ionCube on DreamHost

Tags: cron jobwgetscript phpemail response