cancel
Showing results for 
Search instead for 
Did you mean: 

Setup Cpanel Cron Command for AOE Scheduler

SOLVED

Setup Cpanel Cron Command for AOE Scheduler

Hi all,

 

Thank you for taking to the to read my thread.

 

I have read numerous other threads about setting up Cron, Cron being required for emails in 1.9.0.1 onward and the usefulness of AOE scheduler.

 

I have an installation on shared hosting, the hosting company advised me the command should be:

php /home2/alkalin3/public_html/new/scheduler_cron.php

 

However I have read in previous threads it is best to run the .sh file, so I changed it too:

php /home2/alkalin3/public_html/new/scheduler_cron.sh

 

 

 

Here is my CRON settings in Magento:

 

Looking at AOE Scheduler I get the error message:

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

 

Unless I select all the items and click Run Now, after that I then get the message Last Heartbeat is older than 1 Hour. Please check your configuration.

 

My AOE Scheduler instructions looks like this:

Do I need to add these commands anywhere in order for AOE to run correctly?

 

Please forgive me I have asked a silly question, I am trying to learn and understand Magento and  Cron!

 

Thanks again.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Setup Cpanel Cron Command for AOE Scheduler

Actually your problem is more complicated than that. The message you receive is caused by command line option not forwarded to php. shell/scheduler.php gets executed, but since command line parameters do not reach it, usage help is displayed. It could be cron problem, it could be php problem it could be something else (but definitely hosting related) entirely. Maybe ask your hosting people?

Tanel Raja

View solution in original post

14 REPLIES 14

Re: Setup Cpanel Cron Command for AOE Scheduler

This is no good:

 

php /home2/alkalin3/public_html/new/scheduler_cron.sh

 

You see, this attempts to open scheduler_cron.sh (a shell script) using php interpreter. Obviously it doesn't work. I recommend trying something like it (it uses bash instead):

 

/bin/bash /home2/alkalin3/public_html/new/scheduler_cron.sh

 

Tanel Raja

Re: Setup Cpanel Cron Command for AOE Scheduler

Thanks Pronto I am on the right track now,

 

I have since updated the cron command to:

/bin/bash /home2/alkalin3/public_html/scheduler_cron.sh

 

Also note that I have removed /new/ as it was a temporary directory I have the store in.

 

I now receive the following email when the task is run:

 

X-Powered-By: PHP/5.5.32

Content-type: text/html

 

Available actions:

    --action listAllCodes

    --action lastRun --code <code> [--secondsFromNow] Get the timestamp of the last successful run of a job for a given code

    --action scheduleNow --code <code> Schedule a job to be executed as soon as possible

    --action runNow --code <code> [--tryLock] [--force]           Run a job directly

    --action wait [--timout <timeout=60>]                       Active wait until no schedules are running.

    --action flushSchedules --mode (future|all)            Flush schedules.

    --action listAllRunningSchedules

    --action killAll

    --action watchdog

    --action cron --mode (always|default) [--includeJobs <comma separated list of jobs>] [--excludeJobs <comma separated list of jobs>] [--includeGroups <comma separated list of groups>] [--excludeGroups <comma separated list of groups>]

 

Do I need to add another command to the end of the line?

I have tried to add --mode always or --mode default but still have had no luck.

 

Re: Setup Cpanel Cron Command for AOE Scheduler

Ok, so you need to run two commands. I make a simplified versions of those here, for example I skip maintenance.flag check:

/bin/bash /home2/alkalin3/public_html/scheduler_cron.sh --mode=always

and

 

/bin/bash /home2/alkalin3/public_html/scheduler_cron.sh --mode=default

You should run them every minute (cron pattern * * * * *).

And you should run them as separate jobs. This approach splits all cron stuff between two threads, first one for small stuff that cannot wait and everything else.

 

 

Tanel Raja

Re: Setup Cpanel Cron Command for AOE Scheduler

So I have the two following cron commands running:

 

/bin/bash /home2/alkalin3/public_html/scheduler_cron.sh --mode always
/bin/bash /home2/alkalin3/public_html/scheduler_cron.sh --mode default

I get the following email every time the cronjob on the server runs:

 

X-Powered-By: PHP/5.5.32

Content-type: text/html

 

Available actions:

    --action listAllCodes

    --action lastRun --code <code> [--secondsFromNow] Get the timestamp of the last successful run of a job for a given code

    --action scheduleNow --code <code> Schedule a job to be executed as soon as possible

    --action runNow --code <code> [--tryLock] [--force]           Run a job directly

    --action wait [--timout <timeout=60>]                       Active wait until no schedules are running.

    --action flushSchedules --mode (future|all)            Flush schedules.

    --action listAllRunningSchedules

    --action killAll

    --action watchdog

    --action cron --mode (always|default) [--includeJobs <comma separated list of jobs>] [--excludeJobs <comma separated list of jobs>] [--includeGroups <comma separated list of groups>] [--excludeGroups <comma separated list of groups>]

 

AOE Scheduler still tells me that no heartbeat task is found!

 

I have emailed the hosting company as the output email looks like its asking for an additional action but they assured me that the the two CRON commands are running fine despite the fact that Magento tells me they are not.

 

At this stage I am open to any suggestions as I would just like CRON to run correctly, SOS!!

Re: Setup Cpanel Cron Command for AOE Scheduler

Did you click "Generate Schedule" button as well?

Tanel Raja

Re: Setup Cpanel Cron Command for AOE Scheduler

Thanks for replying again Pronto!

 

Yes, I have clicked generate schedule every time I have changed or updated setting.

 

The hosting company advised me that their Cron can only run on minimum 15 minute intervals, I have my heartbeat task set to */15 * * * * 

 

Is the output email in the previous post correct?

Re: Setup Cpanel Cron Command for AOE Scheduler

Actually your problem is more complicated than that. The message you receive is caused by command line option not forwarded to php. shell/scheduler.php gets executed, but since command line parameters do not reach it, usage help is displayed. It could be cron problem, it could be php problem it could be something else (but definitely hosting related) entirely. Maybe ask your hosting people?

Tanel Raja

Re: Setup Cpanel Cron Command for AOE Scheduler

I have asked the hosting company and they have asked me the following question:

 

Are you able to provide us with a full copy of the cron including all arguments as required by your CMS so we can attempt to recreate it for you?

 

Is this something I can locate in AOE Scheduler?

Re: Setup Cpanel Cron Command for AOE Scheduler

Well after numerous emails to the hosting company it looks like they got it sorted and Cron is finally running correctly!!

 

Thank you Pronto, I could not have gotten this resolved without your help.