简体   繁体   中英

Why is my cron job in directadmin not working?

I have the below php file which runs well in the browser AND from the command line.

<?php

    $ch = curl_init ('http://www.domain.com/test_if_script_runs.php');
    $output = curl_exec ($ch);

?>

The file test_if_script_runs.php only adds a number in a database so that I can see the script runs.

I've set up a cron job in directadmin. In the input fields I've only added 10 for minutes and left all other fields with a star.

So the question is, why is the cron job in directadmin not working?

UPDATE 1:

I checked that in /var/log/cron the path to the file is there. There are no error messages in that file. It seems that the cron is just working fine. However there is no output as when I run the cron from command line or from browser I checked that the file is giving the required output.

I had to put php in front of the command in order to have php process the file. I have something like the below:

php /home/admin/domain.com/public_html/script.php

这是我的方法:

cd /home/user/public_html/any/folder; /usr/local/bin/php -f file.php

这项工作对我来说:

/usr/local/bin/php /home/<USER>/domains/<DOMAIN>/public_html/script.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