Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


i am getting a 406 error page with this cron!

here is the crontab (copied from cPanel):

    * * * * * GET >>

here is the log:

<title>406 Not Acceptable</title>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource /cron/sendSurveyEmails.php could not be found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>

here is my crontab:

* * * * * { cd /var/www/cron && /usr/bin/php -f sendQueuedEmails.php ;} | /usr/bin/logger -t sendQueuedEmails

i am running ubuntu.

i am not seeing any logs in:


where can it be?

share|improve this question

grep "CRON" /var/log/syslog

share|improve this answer
i get: Aug 6 10:33:01 fiqsrv1 CRON[25527]: (cgurnik) CMD ({ cd /var/www/cron && /usr/bin/php -f sendQueuedEmails.php ;} | /usr/bin/logger -t sendQueuedEmails) Aug 6 10:34:01 fiqsrv1 CRON[25533]: (cgurnik) CMD ({ cd /var/www/cron && /usr/bin/php -f sendQueuedEmails.php ;} | /usr/bin/logger -t sendQueuedEmails) but where are the errors and where is the output? – Garrett Aug 6 '10 at 14:36

It should be noted that A) you're not redirecting standard error. So if your scripts are bombing, the errors won't result in the messages file. So put a 2>&1 before the pipe. B) Cron doesn't have squat for environment variables. Are you sure your php script is actually working? There's a good chance it's choking, and hence why there's no output. Try sourcing in your login script like so: . /home/user/.bashrc

--Christopher Karel

share|improve this answer
i now have: * * * * * { cd /var/www/cron && /usr/bin/php -f sendQueuedEmails.php ;} 2>&1 | /usr/bin/logger -t sendQueuedEmails but i don't understand (B). how do i source in my login script? – Garrett Aug 6 '10 at 15:23
Add . /home/username/.bashrc at the start of the script. The . (period and a space) tells the script to reference that file for environment variables. If you're not using bash, you'll have to use the appropriate login script for that shell. (.kshrc, .profile, etc) – Christopher Karel Aug 6 '10 at 19:07
i'm getting a 'bad minute' when i add that =S i am running bash. . /home/cgurnik/.bashrc * * * * * { cd /var/www/cron && /usr/bin/php -f sendQueuedEmails.php ;} 2>&1 | /usr/bin/logger $ – Garrett Aug 6 '10 at 20:16
Nono, sorry. Add it to the start of the script you're trying to call. In this case, since it's PHP...I don't know how that might be handled. (Sorry, I totally didn't notice that at first. Perhaps wrap this whole thing in a single bash script?) Are you certain that your script is actually doing anything? Furthermore, is that cd actually resulting in your script being run from the right location? Perhaps try outputting to a file, rather than using logger? Essentially, try and pin down where things aren't working, rather than the chain of commands at once. – Christopher Karel Aug 6 '10 at 20:43
up vote 0 down vote accepted

it wasn't logging anything. after using GET in my cron (thanks to this answer), i append the output to a log file, like so:

* * * * * GET http://localhost/cron/sendQueuedEmails.php >> /var/www/cron/logs/sendQueuedEmails.log
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.