Re: PHP + Cron jobs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



O/H Waynn Lue ??????:
This is something that I've noticed for awhile, but last post to this
mailing list reminded me that someone probably already knows how to work
around this!  I have a cron job that looks something like

12 6 * * * php /home/foo/temp.php

But even if temp.php doesn't output anything, I still get emails from the
crontab that consist of

"Content-type: text/html"

I assume this is happening because it's interpreting as a web page or some
such.  Is there a better way to set the crontab so I don't get that output?

Thanks,
Waynn

Perhaps this would do the job much better.

12 6 * * * php -f /home/foo/temp.php


Also consider an alternative solution. Add this on the first line of the php script:

#! /usr/bin/php

And make it executable and then put into cron this:

12 6 * * * /home/foo/temp.php


This is if it is an execution problem.

In case you have defined MAILTO directive in the crontab then anything that is executed by cron will mail you the results.
This comes from crons man page:

If MAILTO is defined (and non-empty), mail is sent to the user so named. If MAILTO is defined but empty (MAILTO=""), no mail will be sent.
Otherwise mail is sent to the owner of the crontab.
By default, cron will send mail using the mail ?Content-Type:? header of ?text/plain? with the ?charset=? parameter set to the charmap / codeset of the
locale in which crond(8) is started up



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux