[英]Crontab not functioning properly
I am trying to run a crontab on Ubuntu, I think I get the general idea of how to create a crontab 我正在尝试在Ubuntu上运行crontab,我想我对如何创建crontab有了大致的了解
I did the following... 我做了以下...
1) run command crontab -e
1)运行命令crontab -e
2) add entry 04 22 * * * /var/www/update_ranks >> /root/update_ranks.root.txt
2)添加条目04 22 * * * /var/www/update_ranks >> /root/update_ranks.root.txt
3) check a text file was created under root/ named update_ranks.root.txt
at the specified 3)检查在指定的根目录下名为update_ranks.root.txt
的文本文件是否已创建
time. 时间。
The file update_ranks.root.txt
is empty and the php file is not executed, what am I doing wrong? 文件update_ranks.root.txt
为空,并且未执行php文件,我在做什么错?
If update_ranks
is a bash file try adding sh before the script sh /var/www/update_ranks
如果update_ranks
是bash文件,请尝试在脚本sh /var/www/update_ranks
之前添加sh
By the way, check if you are doing that as root user or user with writing rights to /root
. 顺便说一句,检查您是以root用户还是具有对/root
写权限的用户来执行此操作。 Try sudo crontab -e
. 尝试sudo crontab -e
。
EDIT: 编辑:
If it's a PHP file, you need to execute it in php /usr/bin/php /var/www/update_ranks
and if the file has extension, use this: /usr/bin/php /var/www/update_ranks.php
如果是PHP文件,则需要在php /usr/bin/php /var/www/update_ranks
执行它;如果文件具有扩展名,请使用: /usr/bin/php /var/www/update_ranks.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.