简体   繁体   中英

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

I did the following...

1) run command crontab -e

2) add entry 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
time.

The file update_ranks.root.txt is empty and the php file is not executed, what am I doing wrong?

If update_ranks is a bash file try adding sh before the script sh /var/www/update_ranks

By the way, check if you are doing that as root user or user with writing rights to /root . Try 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM