406使用GET Cron作业错误?

我得到这个cron 406错误页面。

编辑

我更新了cron来代替使用wget,但是我仍然没有从页面获得输出。 这里是新的crontab:

/usr/bin/wget "https://abc.com/cron/sendBulletinEmails.php" >> /home/abc/public_html/cron/logs/sendBulletinEmails.log 

但是,这甚至不使用日志文件。 我收到一封电子邮件。 这里是电子邮件输出:

 --09:20:01-- https://abc.com/cron/sendBulletinEmails.php => `sendBulletinEmails.php' Resolving abc.com... 69.91.162.123 Connecting to fin-iq.com|69.91.162.123|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] 0K 122.58 B/s 09:20:02 (122.58 B/s) - `sendBulletinEmails.php' saved [101] 

我也试过这个crontab(得到正确的输出):

 /usr/bin/wget --append-output=/home/abc/public_html/cron/logs/sendBulletinEmails.log "https://abc.com/cron/sendBulletinEmails.php" 

但是,这也给了我与电子邮件相同的日志。 该页面输出文本,这是我想在我的日志文件中logging。 任何想法如何使这项工作?

再次感谢!

这里是crontab(从cPanel复制):

  * * * * * GET https://abc.com/cron/sendBulletinEmails.php >> /home/abc/public_html/cron/logs/sendBulletinEmails.log 

这里是日志:

 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>406 Not Acceptable</title> </head><body> <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> </body></html> 

另外,当我从我自己的浏览器运行它,它的工作原理。

任何想法为什么发生这种情况? 谢谢=)

从cron获取电子邮件是devise。 你可以通过在行尾添加>/dev/null 2>&1来禁用这个function。 (阅读更多关于cron的信息: http : //adminschoice.com/crontab-quick-reference )

我想问题的其余部分可以通过阅读wget来解决。 您正尝试使用标准输出redirect将输出发送到日志文件。 该文件的内容将永远是你通常在屏幕上看到的。 Wget不显示文件本身,所以输出redirect在这里不起作用。 好消息是wget有一个用于pipe理输出文件的内置开关。

尝试这个:

 /usr/bin/wget -O /home/abc/public_html/cron/logs/sendBulletinEmails.log "https://abc.com/cron/sendBulletinEmails.php" >/dev/null 2>&1 

服务器可能正在查找HTTP_USER_AGENT以阻止自动工具。 如果对您有用,请尝试“wget”。 它支持命令行上的-U or --user-agent=AGENT开关,以帮助您的脚本显示为有效的Firefox / Interner Explorer浏览器会话。

否则,您可能需要编写一个脚本来使用该Perl模块的更强大的function,并使cron作业运行脚本,而不是直接调用get。 我在这里find了一些这样的例子: http : //perlmeme.org/tutorials/lwp.html