[英]Cron Job command not working
I have a simple script in my server and I need a cron job to make it run every minute. 我的服务器中有一个简单的脚本,我需要执行cron作业才能使其每分钟运行一次。 I am using cPanel to set it.
我正在使用cPanel进行设置。 What should I enter in the cron job "command" field?
我应该在cron作业的“命令”字段中输入什么? I am newbie with cron job commands, I have tried many different options:
我是cron job命令的新手,我尝试了许多不同的选项:
/home/enkaizen/public_html/soporte/wp-content/scripts/index.php
/usr/local/bin/php /home/enkaizene/public_html/soporte/wp-content/scripts/index.php
/usr/local/bin/php -q /home/enkaizene/public_html/soporte/wp-content/scripts/index.php
/usr/bin/php /home/enkaizene/public_html/soporte/wp-content/scripts/index.php
/usr/bin/php -q /home/enkaizene/public_html/soporte/wp-content/scripts/index.php
But none seem to be working. 但是似乎没有一个工作。 I know my script is correct because when I run it manually it does what it is suppose to do.
我知道我的脚本是正确的,因为当我手动运行它时,它会执行应做的事情。
For in case it helps, my host is https://www.frenzysolutions.com 万一有帮助,我的主人是https://www.frenzysolutions.com
Any ideas what can I be doing wrong? 有什么想法我会做错什么吗?
To run php from cron try the f flag 要从cron运行php,请尝试f标志
php -f /home/enkaizen/public_html/soporte/wp-content/scripts/index.php
It is best practice to use the full path to the executable when using cron. 最佳实践是在使用cron时使用可执行文件的完整路径。 Unfortunately this is distribution/os dependent but it is probably either
/usr/bin/php
or /usr/local/bin/php
不幸的是,这取决于发行版/ os,但可能是
/usr/bin/php
或/usr/local/bin/php
Are you getting any error with "php -q" command ? 您是否在使用“ php -q”命令时遇到任何错误?
Also you can use curl command instead of php -q to execute your scripts through command line. 您也可以使用curl命令而不是php -q通过命令行执行脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.