Question

Applied Catalog price rules but they are being removed within 24 hr period.

So far I have; *added end dates to rules *re-indexed *flushed cache *change time zone code (as per other posts suggestions) *setup Cron on Cpanel *set whm timezone to be the same as magento EstSt-Sydney *changed core file refresh.php $timestamp = Mage::app()->getLocale()->date(null, null, null, true)->get(Zend_Date::TIMESTAMP);

I feel like the cron is working but there is a specific error with catalog price rules.

here is the log output for cron.log

2019-01-31T14:06:02+00:00 DEBUG (7): Job "catalogrule_apply_all" (id: 2664765) disappeared. Message: Process "1322" on host ".smartservers.com.au" cannot be found anymore 2019-01-31T14:06:02+00:00 DEBUG (7): Job "catalogrule_apply_all" (id: 2664765) disappeared. Message: Host ".smartservers.com.au" has not been available for a while now to update the status of this task and the task is not reporting back by itself

it states disappeared? (thank you log file ;D)

My Cron setup in magento is as such: or correct URLs generated during cron runs please make sure that Web > Secure


If this is disabled no scheduled jobs will be executed

[GLOBAL]
Generate Schedules Every

15 [STORE VIEW]
Schedule Ahead for

20 [STORE VIEW]
Missed if Not Run Within

15 [STORE VIEW]
History Cleanup Every

10 [STORE VIEW]
Success History Lifetime

60 [STORE VIEW]
Failure History Lifetime

600 [STORE VIEW]
Mark job as failed after

15 A job will be marked es failed after it hasn't been seen for this many minutes (in cases where the process cannot be checked)

[GLOBAL]
Maximum job runtime

If set a single job can't run longer than this time (in minutes). If the job is actually still running this process will be actively killed.

[GLOBAL]
Heartbeat task schedule (cron syntax)

*/5 * * * * [GLOBAL]
Error Email Recipient

[GLOBAL]
Error Email Sender [GLOBAL]
Error Email Template [GLOBAL]
Log file

cron.log Keep empty to disable logging

[GLOBAL]
Maximum number of successful schedules to keep

Only keeps this number of entries for every schedule even if it is shorter than the configured success lifetime. Set to 0 to keep them all until they hit the lifetime.

[GLOBAL]
Enable "run now"

Cron tasks are usually designed to run in CLI context and not in the context of the webserver. Also they could run longer than the configured maximum execution time. This is why you should rather use "scheduleNow" instead of "runNow" and let the scheduler pick up the task on the next run. However, if you know what you're doing and/or if you don't want to wait while testing and developing a cron task you can enable this feature here.

[GLOBAL]
Enable Job Output Buffering

If this is enabled jobs will capture normal output for storage in the schedule record messages field

[GLOBAL]
Enable Error Log

If enabled AOE_Scheduler will bypass Magento's error handling and will capture the error log in a schedule specific file in var/log/cron/

[GLOBAL]
Job code filter type in list view [GLOBAL]
System user for cron

Specify the system user that should be running cron jobs. If not specified, a warning message will show whenever the scheduler is run suggesting this value be set. You can disable it below.

[GLOBAL]
Show cron user message

If enabled, a warning will be displayed if the system user running the cron does not match the user provided above.

[GLOBAL]
Kill processes by wrong user

You can prevent processes from being run as the wrong user by enabling this setting.

[GLOBAL]
Run only if cache prefix id matches


My cpanel cron job is as such:

/usr/local/bin/php /home/mysite/public_html/cron.php

I innitially had cron.sh as the path but this did not seem to work so I am now trying .php as per another thread suggestion.


I think I have tried all suggestions but the price rules are still being removed. It could be a simple config setting I am missing or the cron is not running properly but it looks as though it is for all other processes.

From a couple threads it suggests that My timezones are different and this is causing the error but I have double checked and the server timezone is the same as my magento timezone.

To make issues even more interesting.. I have a dev version of magento running on the exact same server with a copy of the original magento and it has the same data and catalogs.. I applied the rules to these and they have stayed active 100% of the time.

I almost feel as though sales/transactions on the sale items are affecting this as much as anything else.

Any help or direction from here is appreciated.

Was it helpful?

Solution

Create new cronjob for price rule Create a rule.php file on root directory

And add below code in it

require_once 'app/Mage.php';
Mage::app('admin');
$catalogRule = Mage::getModel('catalogrule/rule');
$catalogRule->applyAll();
Mage::app()->removeCache('catalog_rules_dirty');

Schedule it for every hour

0 * * * * /var/www/yourdirectory/price.php

Note: cronjob path would be dependent on you magento directory path

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top