Re: PHP + Cron jobs

From: Date: Sat, 27 Sep 2008 13:08:29 +0000
Subject: Re: PHP + Cron jobs
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-281034@lists.php.net to get a copy of this message
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

« previous php.general (#281034) next »