Cronjob not working - tried all advices

lowprofile787

Verified User
Joined
Nov 1, 2012
Messages
4
Hi

Installed a new server with CentOS 6.6, Nginx_apache, php-fpm.
Since install, cronjobs haven't been working. If you run the job in ssh manually, it works great.

e.x
php /home/magento/domains/demo.com/public_html/cron.php > /dev/null

also tried: cd /home/magento/domains/demo.com/public_html/; /usr/local/bin/php ./cron.php

I have a 6.5 installation, with same settings (except no nginx)
It works great on that box with "php /home/magento/domains/demo.com/public_html/cron.php > /dev/null"
Softacolous add on same base and work great on old box, but this one wont work. Only from SSH.

I've tried 10-12 different combination, adviced in earlier threads. What is wrong?!

cronjob log shows:
Mar 4 00:48:01 m1 CROND[38622]: (root) CMD (/usr/local/directadmin/dataskq)
Mar 4 00:48:01 m1 CROND[38624]: (root) CMD (/usr/bin/python /usr/sbin/statsnotifer check-admin)
Mar 4 00:48:01 m1 CROND[38623]: (magento) CMD (cd /home/magento/domains/demo.com/public_html/; /usr/local/bin/php ./cron.php)
 
Hello,

What error do you see if you run the command in a console?

Code:
[COLOR=#333333]php /home/magento/domains/demo.com/public_html/cron.php
?[/COLOR]
 
Hello,

What error do you see if you run the command in a console?

Code:
[COLOR=#333333]php /home/magento/domains/demo.com/public_html/cron.php
?[/COLOR]

There is no error, since the command works great. As i wrote earlier, if i run the command from console/ssh, it works properly.
But it wont run from directadmin, i've also tried different syntax for running every minute etc. */1 or 1,2,3,4,5,6 - it just dont work.

The command seems not to be run from cronjobs. I have a another box which works great. So i expect the version (6.6) or the nginx_apache together with directadmin
 
FYI, always use full binary paths, so:
Code:
/usr/local/bin/php /home/magento/domains/demo.com/public_html/cron.php
as the cron environement typically has different an entirely different set of $PATH values, so just "php" often isn't found.

John
 
FYI, always use full binary paths, so:
Code:
/usr/local/bin/php /home/magento/domains/demo.com/public_html/cron.php
as the cron environement typically has different an entirely different set of $PATH values, so just "php" often isn't found.

John

thanks , I test it
 
but I opened Cronjob page , I see added even this format :
FYI, always use full binary paths, so:
Code:
/usr/local/bin/php /home/magento/domains/demo.com/public_html/cron.php
as the cron environement typically has different an entirely different set of $PATH values, so just "php" often isn't found.

John



this is one of my cron codes :

/usr/local/bin/php -q /home/kando/domains/demo.com/public_html/client/crons/cron.php >/dev/null 2>&1

or this :

/usr/bin/php -q /home/kando/domains/demo.com/public_html/client/crons/cron.php

or this :

wget -O /dev/null "https://demo.com/blog/index.php?jbcjlink=1" > /dev/null 2>&1 --no-check-certificate

or this :

/usr/bin/php -q /home/kando/domains/demo.com/public_html/client/crons/cron.php --force

or this :

/usr/local/bin/php -q /home/kando/domains/demo.com/public_html/client/crons/cron.php --force

But with all these added codes, none of them was effective and does not work!



While it was working well with a code on cronjob, before installing the CloudLinux!

I'm really confused and I don't know what effect it has had on this, which has caused cronjob to stop working!
Do you think disabling PHP-Selector Section, will have an effect?
 
/usr/local/bin/php
Still not what I suggested.
However that's a symlink to the default php version on the server. But it can give an issue if user kando has selected to use php 8.1 and the default on the server is php 8.0, which is exactly why I made the suggestion to do it otherwise, because maybe the php selector was throwing issues.

But I presume you already checked that user kando has choosen the same php version in his account as the /usr/local/bin/php is symlinked to.
If the symlink still exists after the Cloudlinux install.

You could try to disable the PHP-Selector Section and test it, but as said, I don't use Cloudlinux so maybe somebody else has an idea.

Since it's happening after the Cloudlinux install, seems to me DA is working as should be and Cloudlinux is messing up, so maybe you get a better answer from Cloudlinux support on this.
 
my using php version is 7.4

What do you think about the case that I have installed this CloudLinux, the path of "/usr/local/bin/php " has changed and I should put this " /usr/local/php74/lib " or " /opt/alt/php74/usr/bin/php " instead of " /usr/local/bin/php " ?
 
the path of "/usr/local/bin/php " has changed
This path shouldn't have changed. There is still a php binary in there.
Check it's symlink. If it's pointing to /usr/local/php74/bin/php or where it's symlinking to. DA normally points it to the default php install, which is the first php version mentioned in the /usr/local/directadmin/custombuild/options.conf file.

/opt/alt/php74/usr/bin/php
If you have this, then most likely this is what Cloudlinux installed.
In that case there is a very big chance that you should point the crontab to this.

But again, i don't use Cloudlinux so I can't guarantee it.
@jamgames2 do you use cloudlinux? Any idea on this?
 
@Richard G
nope, I use only Rhel ( all fork free OS ) and Ubuntu ( all fork free OS ).

@1saeed
if you don't sure what's version currently in use that work or not.
execute these command
Code:
php -v
/usr/local/php74/bin/php -v
/opt/alt/php74/usr/bin/php -v
 
I find and fix this problem!
At first, I disabled the PHP-Selector of CloudLinux, but when test, not fix this issue,
and I disabled CageFs, after disabling these two options, cronjobs started working and this case was fixed!

thanks to all my friends for helping me on this topic , :love:?
 
Great! Thank you for sharing the solution to benefit others. (y)

Just 1 question, I see most hosters are using the PHP-Selector of Cloudlinux.
Did you also try with PHP-Selector enabled but only CageFS disabled?
 
Back
Top