找不到 cron 命令 - CentOS 7

cron command not found - CentOS 7

我使用的是 CentOS 7。

我想 运行 我的 laravel 命令:

* * * * * cd /home/path/ && php artisan schedule:run >> /dev/null 2>&1

但是当我 运行 上面的代码时,我收到了这个错误消息:

-bash: cpanel3-skel: command not found

您必须将此 cron 条目添加到您的 crontab,而不是 运行 它作为命令。在 CentOS 上,使用以下命令在文本编辑器中打开 crontab:

crontab -e

然后将您的 cron 条目 * * * * * cd /home/path/ && php artisan schedule:run >> /dev/null 2>&1 添加到文件末尾并保存更改。

转到您的终端,ssh 进入您的服务器,cd 进入您的项目,然后 运行 这个命令。

crontab -e

这将打开服务器 Crontab 文件,将下面的代码粘贴到文件中,保存然后退出。

* * * * * cd /home/path/ && php artisan schedule:run >> /dev/null 2>&1

现在,如果您想查看当前 运行ning 的 cron 列表,请使用以下命令。

crontab –l