我的crontab中有以下条目:
SHELL="/bin/bash"
* * * * * /home/peepzcoz/public_html/testapp/bin/cake ClientReminder
* * * * * /home/peepzcoz/public_html/testapp/bin/cake StaffReminder
* * * * * /home/peepzcoz/public_html/testapp/bin/cake ProcessJobRequests
所有这些将结果通过电子邮件发送到邮箱。但是对于所有这些人,我都会收到以下消息:
Status: 500 Internal Server Error
X-Powered-By: PHP/7.2.8
Content-type: text/html; charset=UTF-8
调试已在我的app.php
配置文件中打开。
如果我像这样更改crontab:
SHELL="/bin/bash"
* * * * * /usr/local/bin/php /home/peepzcoz/public_html/testapp/bin/cake ClientReminder
* * * * * /usr/local/bin/php /home/peepzcoz/public_html/testapp/bin/cake StaffReminder
* * * * * /usr/local/bin/php /home/peepzcoz/public_html/testapp/bin/cake ProcessJobRequests
我得到这个结果:
################################################################################
#
# Cake is a shell script for invoking CakePHP shell commands
#
# CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
# Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
#
# @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
# @link https://cakephp.org CakePHP(tm) Project
# @since 1.2.0
# @license https://opensource.org/licenses/mit-license.php MIT License
#
################################################################################
# Canonicalize by following every symlink of the given name recursively
canonicalize() {
NAME="$1"
if [ -f "$NAME" ]
then
DIR=$(dirname -- "$NAME")
NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
fi
while [ -h "$NAME" ]; do
DIR=$(dirname -- "$NAME")
SYM=$(readlink "$NAME")
NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM")
done
echo "$NAME"
}
CONSOLE=$(dirname -- "$(canonicalize "$0")")
APP=$(dirname "$CONSOLE")
if [ $(basename $0) != 'cake' ]
then
exec php "$CONSOLE"/cake.php $(basename $0) "$@"
else
exec php "$CONSOLE"/cake.php "$@"
fi
exit
如果我直接在终端中运行它,它可以很好地执行,并且所有操作都按照他们的预期进行。
如何获取调试输出,以便至少了解问题所在?我在此服务器上看不到错误日志,蛋糕日志文件夹中的错误日志为空。
我还能检查什么?
答案 0 :(得分:0)
好的,所以我通过下载bin/cake
的最新版本解决了这个问题。但这不是那么简单。
首先,我将其下载到Windows机器上,然后将其上传到服务器,该服务器将行尾更改为Windows行尾。这导致了一个新的错误:
/usr/bin/env: sh
: No such file or directory
因此,我尝试运行dos2unix bin/cake
,但是共享服务器上未安装dos2unix
。
我通过在原始文件上执行wget并覆盖bin/cake
文件来解决此问题。这样就解决了,我的朋友们开始运转了。
有点偏离主题,但是您可以通过向自己的cronjob中添加DEBUG=1
来查看调试信息:
* * * * * DEBUG=1 /home/peepzcoz/public_html/testapp/bin/cake ClientReminder