1

I setup cronjob on server's crontab

*/5 * * * * /home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1

30 3 * * * php /home/users/mydomain/www/shell/indexer.php --reindex catalog_url

it seems working on server

[root@ /var/log]# grep '/home/users/mydomain/www/cron.php' cron

May 10 16:00:01 crond[21592]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:05:01 crond[21718]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:10:01 crond[21766]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)

but when I check the cron scheduler module I can see that cronjob is not working

Last heartbeat is older than one hour. Please check your settings and your configuration!

Both cronjob and scheduler works well before I moved my all files to other folders

How can I check Cronjob is working and make it work?

5

Take a view to your MySQL Database > table cron_schedule. There are all magento created jobs with timestamp of creation, scheduled, executed and their status.

If anything wrong, then look for the cron job in the table and see if there is any log in the messages column.

| improve this answer | |
0
*/5 * * * * sh /home/users/mydomain/www/cron.sh >> /home/users/mydomain/www/var/log/cron.log 2>&1

Use cron.sh, not cron.php, which you will need php for.

| improve this answer | |
0

First of all, check that whether your cron is scheduled or not, to check this run your cron, as cron runs it makes the entry in database, if you find that entry in your database that means your cron is scheduled correctly.

And if it is scheduled correctly but not running, in this case there may be two possibilities- First is you may have written the wrong file path where the cron has to be run, or You have made some mistakes on the piece of code where you have called the cron function. To check this you can apply the logger on that code to find the error that why your cron is not working. As you apply the logger, it will make a log file /var/log/ in the magento root directory through which you can find the error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.