cancel
Showing results for 
Search instead for 
Did you mean: 

My CRON jobs stopped working when changing to a different server

My CRON jobs stopped working when changing to a different server

Hi Guys,

I changed my shared hosting to an enterprise server with more CPU, RAM and SSD drives, it's much faster,(it's with the same hosting company). But my cron jobs aren't running and the AOE heartbeat isn't running either. All scheduled jobs are still scheduled, but they all say pending. 

I get this is in System > scheduler:

No heartbeat task found. Check if cron is configured correctly.

 

I can see that they stopped working when my website was migrated.

My developer told me to check in my cPanel, but that seems to be correct, he tried too, but can't get the heartbeat or cron jobs running either.

 

Any suggestions?

 

V1.9.3.6, fully patched this week.

4 REPLIES 4

Re: My CRON jobs stopped working when changing to a different server

@Magento_SuperDid you configure the cron using Cpanel or from the SSH in crontab?

 

I would recommend to run the cron from command line to see if they are working. Use or copy the same command from cpanel and run it in the SSH / command line. It must throw you an error or must run fine.

 

Seems like job is not configured in crontab causing the issue.

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: My CRON jobs stopped working when changing to a different server

Thanks for your reply, it's much appreciated!

 

I tried running a command from the terminal in cPanel, is that what you meant?

 

(Is there a different place to run commands?)

 

Nothing happened.

This is what I ran:

 

cd /home/XXXXXXX/public_html/shell && /usr/bin/php scheduler.php --action watchdog

 

(username removed)

Does this look right?

Also in cPanel Cron Jobs is:

 

sh /home/XXXXXXXpublic_html/scheduler_cron.sh --mode always

My hosting company said this:

 

Some of the cron jobs do appear to be working, while some have invalid syntax (for example cd is to enter a directory and not used to execute a file). Also 4 of the cron jobs listed in cPanel seem to be duplicated. I've done my best to tidy things up. Please check the following.

I've amended it so cron.sh and cron.php run every 15 minutes, but I think both those files do the same task so only one cron job is needed?

I've amended scheduler_cron.sh to run every 10 minutes, please can you confirm the two modes it needs to run under are "always" and "default"? What's the difference in those two modes and are both necessary to run every 10 mins?

Lastly "scheduler.php --action watchdog" should run every 20 minutes. We usually request cron jobs are not executed more frequently than every 15 minutes, unless there's a real need for it. We often find cron jobs that are scheduled every minute are often only required once/twice a day, and having an appropriate frequency will require the CPU/memory usage on your hosting account.

 

My occasional developer, who is too busy to have a good look, says that it is definitely an issue with the hosting company.

 

 

 

 

Re: My CRON jobs stopped working when changing to a different server

Update:

 

Note that in my code there is a space between

php /home/

cd /home/

sh /home/

Is this correct?

Re: My CRON jobs stopped working when changing to a different server

@Magento_SuperYes you need to run either cron.sh or cron.php. There has to be a space between a command php <space> /home.

 

Let know if things are working for you. Not sure who is your hosting provider. Something they can also help you in fixing the issue. There are chances that you have kept the same path in cron as old server while at new server path for your code and cron files are different.

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.