How to Set up Magento Cron job

It's only fair to share...Share on Google+Pin on PinterestTweet about this on TwitterShare on LinkedIn

Cron job is basically a scheduler that enables unix users to execute commands at a given time. The cron job is automated process which runs as per the commands generated.  In Magento, a cron job is very handy and can used for multiple roles such as updating your suppliers cvs on daily basis or downloading the products or sales into your ERP or even small functions as sitemap generation, sending scheduled emails or updates etc.

You can set up Crons job via multiple platforms including:

  • cron job via cPanel
  • via Commands
  • Magento cron task via SSH

cron job via cPanel

Via cPanel, setting cron job is easy. .Go to Cronjob Manager inside the control panel. Make sure no other cronjob has been set up calling the cron.php file of Magento, and if that’s the case, remove it before adding this cronjob. Add a cronjob with the following parameters:
Minute: */5
This means the cronjob will be run every 5 minutes. It is very important that the cron.php file of Magento gets executed every five minutes. Do not change this to a longer interval.
Hour: *
Day: *
Month: *
Weekday: *
Command: wget -O /dev/null -q http://www.YOURDOMAIN.com/PATH_TO_MAGENTO/cron.php > /dev/null

Press Add New Cron Job to finish your configuration.

Magento cron task via SSH

Log in to the server via SSH. Run crontab -e command to add a cron task. At this point you will see a text editor, where you can add or edit cron tasks. Starting from a new line, add the following record:

1
*/5 * * * * sh /path/to/your/magento/site/root/cron.sh

Again, don’t forget to insert your own default folder path!

Save the changes and close the file. If you did everything correctly, crontab -l command will show you the newly created task.

For more information and all your Magento Development needs, please contact Platina IT.