Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Issues With Cron and Catalog price rules
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Because this:

catch (Exception $e{
    Mage
::printException($e);
}

is missing in action. Add it in after your try {block}. Try/Catch is a two step process. Try to do something and then catch errors.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdaweb
Jr. Member
 
Total Posts:  10
Joined:  2010-05-14
 

That fixed the error! Sweet.

Now how do I get this to re-apply my catalog price rules? My cronmon just shows “newsletter_send_all”.

https://memoryjewelsstore.com/cronmon.php

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Set up your Cron log so that you aren’t limited to a ridiculously short time span for monitoring finished jobs. Otherwise, all you see is that darn newsletter_send_all.

Go into your Advanced System Config and set Cron Success History Lifetime and Failure Lifetime both to 1440 so you are monitoring a 24 hour span of time.

You will now be able to see index operations, etc in the time stream. There will be about 300 jobs listed in your Jobs Sucessful section over the 24 hour timespan.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hajomagre
Jr. Member
 
Total Posts:  3
Joined:  2010-01-12
 

Note: if you can’t get cronmon.php working (a script mentiod a couple of times in the above pages of this thread), check if Magento added a prefix to all your table names in your database. You can let Magento do this on install, and I did, but forgot.

If you use a table prefix, then add the prefix (in my case “magento_") to the lines in cronmon.php where the table name is used:

around line 21

$query='SELECT * FROM `magento_cron_schedule` WHERE `status` ="pending" ORDER BY `scheduled_at` DESC' ;

around line 58

$query='SELECT * FROM `magento_cron_schedule` WHERE `status` ="success" ORDER BY `executed_at` DESC' ;
 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

@hagomagre

This version of CronMonitor actually reads your local.xml confguration and takes care of all the Magento DB login, DB name, etc and even automagically checks and includes your table prefix if you’re using one. Got tired of editing a bunch of variables every time I wanted to repurpose it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hajomagre
Jr. Member
 
Total Posts:  3
Joined:  2010-01-12
 

@chiefair: tnx for your help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
hyserure
Jr. Member
 
Total Posts:  27
Joined:  2009-10-06
 

Hi all,

I have read through all 8 pages of this thread and I am about to throw my computer out the window. I have the cronmon.php tool working well, I have increased the execution time to 1000 and memory limit to 512MB, and I have confirmed that the cron job inside cpanel on the server is running successfully every 15 minutes.

Here is the command line in cpanel:  /usr/bin/php -c /home/designer/public_html/php.ini -f /home/designer/public_html/cron.php

Here is the problem:  Every 15 minutes, I have a cron tab set to run an ebay synchronizing script. This is set up in the module’s etc/config.xml file. The script will run properly for a while, and then it will just stop. And not run anymore after that, until I manually re-run the con job (by typing in http://mydomain.com/cron.php). The longest period of time that I have had it working properly before stopping is less than 24 hours.

I checked the database cron_schedule table, and I found this next to the scheduled task, which is labeled “Missed”:

exception ‘Mage_Core_Exception’ with message ‘Too late for the schedule.’ in /home/designer/public_html/app/Mage.php:550
Stack trace:
#0 /home/designer/public_html/app/code/core/Mage/Cron/Model/Observer.php(81): Mage::throwException(’Too late for th...’)
#1 /home/designer/public_html/app/code/core/Mage/Core/Model/App.php(1225): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
#2 /home/designer/public_html/app/code/core/Mage/Core/Model/App.php(1206): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Cron_Model_Observer), ‘dispatch’, Object(Varien_Event_Observer))
#3 /home/designer/public_html/app/Mage.php(416): Mage_Core_Model_App->dispatchEvent(’default’, Array)
#4 /home/designer/public_html/cron.php(49): Mage::dispatchEvent(’default’)
#5 {main}

Also, here are my Admin Panel cron settings:

Generate schedules every 15 minutes
Schedule ahead for 20 minutes
Missed if not run within 120 minutes
History cleanup every 240 minutes
Success history lifetime 240 minutes
Failure history lifetime 240 minutes

Can anyone tell me why I’m getting that “Fatal Execption - Too Late For Schedule” error?? I have tried tweaking the admin panel settings (above) but I still keep getting that error eventually.

Thanks for your help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
susieqzyo
Jr. Member
 
Total Posts:  9
Joined:  2009-03-04
 

ok, i’ve read this whole thread.  I see that a couple of other folks have had the same problem I’m having, which is that only the newsletter and catalogindex jobs are showing as scheduled and running.  My catalog price rules still disappear about every 2 days.  Can anyone tell me how they fixed this problem?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pooch
Member
 
Total Posts:  70
Joined:  2008-05-15
Danville, CA USA
 
chiefair - 15 November 2010 12:16 PM

@hagomagre

This version of CronMonitor actually reads your local.xml confguration and takes care of all the Magento DB login, DB name, etc and even automagically checks and includes your table prefix if you’re using one. Got tired of editing a bunch of variables every time I wanted to repurpose it.

Chiefair- this is probably a better way to get your DB configuration and attaching. It uses the native Magento funtions to grab your info and connects via the native PDO mysql factory.

<?php
// Path to Mage.php still assuming you're running this out of a /scripts dir in your doc root
require_once '../app/Mage.php';
umask(0);
Mage::app('default');

$config Mage::getConfig()->getResourceConnectionConfig('core_write');
//DB Settings
$dbConfig = array(
                  
'host'      => $config->host,
                  
'username'  => $config->username,
                  
'password'  => $config->password,
                  
'dbname'    => $config->dbname,
                  
'driver_options'=> array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => tr$
                  );

// Connect to the database
$db_magento Zend_Db::factory('Pdo_Mysql'$dbConfig);

//From there I'd run your queries like this:
 
$result $db_magento->query("SELECT status FROM cron_schedule WHERE schedule_id = 123 ")
//And pull field results like this
$status $result->fetchObject()->status

Will entail a little refactoring of your code obviously but it’s probably good to get in the habit of using PDO to access the DB since that’s the way Magento does it natively. Once you get used to it you’ll wonder how you ever did without.

More reference here on the methods you can use:
http://php.net/manual/en/book.pdo.php

In particular look at the PDOStatement class. You’ll probably just be using things like rowCount, fetchAll, fetchObject

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Thanks! I’ll give it a look…

 
Magento Community Magento Community
Magento Community
Magento Community
 
fashionretailer
Jr. Member
 
Avatar
Total Posts:  13
Joined:  2011-03-02
 

the cronmon.php worked great! then I put in the mail testing in my cron.php and it sent to me! so I took it out and the second I saved the file back the newsletter went out! thank goodness!!! hopefully now my cron will execute properly!!! thanks so much for these tips!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
billybjr
Jr. Member
 
Total Posts:  16
Joined:  2010-05-19
 

This is driving me crazy.  My cron is running.  The catalog rules show being applied.  The retail and wholesale prices show up in the items grid or list correctly.  But any items that are left in the shopping cart revert to the non discounted price after a couple of days.  They price correctly as soon as I manually apply the rules.  I’m running ver 1.5.0.1 Anybody have any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kevinrys
Jr. Member
 
Total Posts:  18
Joined:  2010-11-09
 

So i’ve followed every topic on here to get my cron working, checking newsletter sending, etc.  The first set of emails send out with no problem.  I was running cron manually before but have got it setup to run now.  It looks like my newsletter_send_all simply hangs now and does nothing.  I’m not sure if there is a line of code which cuts off the amount the newsletter can send out in total?  I’ve edited app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php and app/code/core/Mage/Newsletter/Model/Observer.php and changed the code to $countOfSubscritions = 100;

I am using 1.5.0.1.  Is there another file I need to edit/line to change?  Please help I need to get our newsletter out to the other few thousand subscribers, and only 150 will not cut it.  I figure there has to be a line of code I need to change somewhere as my last newsletter only sent out 150 as well.  I feel like there is another file which I may have edited trying to get this to work, and may have blocked myself (but i cant find/remember that file).  Possibly a config.xml or something like that?

Ive checked with my host and I’m not hitting my 750/emails per hour limit, so thats not the problem.  I added the send email code to my cron.php so I know its running.  You can view my cron monitor file here: http://blaze1.com/cronmon.php which shows the newsletter_send_all to just be hanging there....

Also when running cron.php, I sometimes get the error: Fatal error:  Call to a member function addQueueData() on a non-object in /home8/blazeon1/public_html/app/code/core/Mage/Newsletter/Model/Queue.php on line 193 but with another refresh or two it usually goes away. II dont think this is the issue though, but worth nothing.

Please HELP!

 
Magento Community Magento Community
Magento Community
Magento Community
 
furnitureforyoultd
Enthusiast
 
Total Posts:  833
Joined:  2009-03-09
 

Have been having cron problems too and wasn’t able to resolve them by any method in this thread. I can see that xmlconnect and newsletters are added to the cron database and executed successfully but things like catalogrules aren’t added what so ever

Found this extension: Magento Cron Schedule

Setup cron to execute a text file containing all the scheduler.php shell commands and it all seems to work fine

If you only have problems with catalog price rules you can just use one line and set it at the interval you want

php -f /path/to/magento/shell/scheduler.php -action runNow -code catalogrule_apply_all

that should apply the catalog price rules, using cronman.php should confirm that it was successful

 
Magento Community Magento Community
Magento Community
Magento Community
 
youderian
Jr. Member
 
Total Posts:  20
Joined:  2009-07-15
 

As a bit of a UNIX noob, and someone who is also trying to successfully get cron jobs to run correctly (in order to limit log files), I’d like to spell out what I THINK is the right process for the cron system to effectively work.  If someone could give me an affirmative ‘Yes’, you’re correct, that would be extremely helpful and will hopefully also reduce confusion for others.

1.  Cron.sh needs to be run via a system crontab job
2.  Cron.sh, in turn, calls cron.php
3.  Cron.php interfaces with all the modules in Magento that need to have cron work done
4.  Individual module cron settings are set within each module

Is this a correct way of thinking about everything?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top