Home >Setup Cron Jobs in Magento 1

Setup Cron Jobs in Magento 1

In this instruction, we will show two ways of Cron Job Setup in Magento (Magento 1) which is by using either Cpanel or SSH

Setup Cron Jobs via Cpanel

Firstly, sign in Cpanel. Then go to Cron Job setting section by navigating to Advanced → Cron Jobs.

Now, we need to complete timing and command settings for Cron Jobs. Here we are installing Cron Job for Magento, so let’s set the Command as * * * * * /usr/bin/php -f /path/to/magento/root/cron.php. This means server will run file cron.php at Magento root folder once every minute.

Finally, just click on “Add New Cron Job” button to finish.

Setup Cron Job via SSH

It’s obviously that you have to sign in SSH at first.

To see current Cron Jobs, use crontab –1. To fix a Cron Job or add a new one, use crontab –e. After that, a text editor (e.g. vi editor) can be used to edit Cron Jobs before they are saved.

This is how to write a Cron Job command:

To get the idea more clearly, you can see some examples of Cron Job commands for common schedules

  • For Cron running  at 0:00 every Monday, write 0 0 * * 1 [command]
  • For Cron running every 5 minutes, write */5 * * * * [command]
  • For Cron running at 0 minute, 10 minutes and 20 minutes every hour, wirte 0,10,20 * * * * [command]
  • For Cron running at 6:00 everyday, write 0 6 * * * [command]

Now take a look at basic usage of vi editor:

Open a file by vi editor, use vi [filename] (vi testfile.txt for instance). It will open the file of that name or creat a new one if that file does not exist. Then click Insert to modify the file.

To save it after all modification, click Esc then use :wq!. In case you only want to quit vi editor without saving any changes, just use :q!

That’s all. It’s clearly not a kind of tricky techniques. Vote if you find this instruction helpful or let us know what you think about it in comments.


< Previous Post
Next Post >
+ posts