0
votes

I have refer magentocommerce.com for setting up the cron job. I implemented what i get from that. At first i added cront tab in config.xml file. which i have done for my module "Ownmodule_Autocancel" is shown:

<crontab>
        <jobs>
            <ownmodule_auto_cancel>
                <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
                <run><model>order/observer::cancelPendingOrders</model></run>
            </ownmodule_auto_cancel>
        </jobs>
</crontab>

Then I opened terminal in linux, given with file permission,

crontab -e

*/5 * * * * php -q /var/www/LIVE/magento/cron.php

Ctrl+x -> Y(for save)

ps aux | grep ping (what i got in the terminal window is)

itss 7746 0.0 0.1 95996 2664 ? Sl 09:29 0:00 /usr/lib/i386-linux-gnu/unity-lens-shopping/unity-shopping-daemon

itss 10106 0.0 0.0 4436 820 pts/0 S+ 11:18 0:00 grep --color=auto ping

kill 7746

ps aux | grep ping (what i got in the terminal window is)

itss 10106 0.0 0.0 4436 820 pts/0 S+ 11:18 0:00 grep --color=auto ping

crontab -l (what i got in the terminal window is)

*/5 * * * * php -q/var/www/LIVE/magento/cron.php

But something is not woking. I don't know how to schedule time in backend cron (scheduled tasks) for 5 min. Please check the above job and give me correct solution. this is done for my module. And also if i missed some other task to done for setting cron job, kindly let me know.

1
There only I'm having doubt.. I mean at system->configuration->advanced->system->cron (How to setup this)... And also having doubt in the line */5 * * * * php -q/var/www/LIVE/magento/cron.php.. is it correct.. because in some other sites i get the same line as like */5 * * * *usr/bin/ php -f /var/www/LIVE/magento/cron.php.. So only i posted here.. pls clear these two and also let me know whether i want to some other tasks for setting cron or this mch is enough - 4519398

1 Answers

0
votes

On every cron.php run the system schedules all jobs which should be started in time equal to "Schedule Ahead for" field. Then it checks if all pending(already scheduled) jobs should run, if yes, the it starts the process.

"Generate Schedules Every" is a time interval between schedules generation into queue. "Schedule Ahead for" is a time interval, which determines how forward in time should cronjobs be added into pending queue.

So basically you should set "Schedule Ahead for" the same as "Generate Schedules Every" or a bit greater. The time is up to you, but it should be greater than time you set in your SSH crontab.

To check if crontab is working you can check database table "cron_schedule" to see if there are any jobs scheduled.

Is it "php" or "usr/bin/php" depends on the server. It could be "usr/local/bin/php".