Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up a cron job in Magento [closed]

Tags:

php

cron

magento

Can someone please explain me, what I have to do? I want Magento to clean logs, create a sitemap every day.

Is this the right order:

  1. Setup Cron in Server
  2. Setup Cron in Magento
  3. What will be next step?

How do I do step 1 and 2? What will be step 3? Do I have to wait?

like image 691
Haudegen Avatar asked Mar 22 '23 20:03

Haudegen


1 Answers

Setting up cron on your server

Use crontab -e to edit your cron jobs. To run a daily cron, add a line like this:

0 3 * * *  /bin/sh /path/to/magento/cron.sh

This will run at 3 AM every night.

For log cleaning, you can check /path/to/magento/shell/log.php.

Set up cron in Magento

In the Magento admin, go to: System > Configuration > Advanced > System > Cron (Scheduled Tasks) and configure cron jobs you wish to run.

You should know that Magento runs cron jobs even if you don't have a daily cron job configured. Whenever Magento receives a request, it checks if there are any cron jobs to be run. Therefore, having the daily cron job would only make sense if you had no requests for an entire day.

Really there is no next step to be done. I recommend you read How to Set Up a Cron Job.

like image 185
pymkin Avatar answered Apr 25 '23 03:04

pymkin