Magento 1: How to setup a cron job for Magento in Parallels Plesk Panel Imprimer

  • 170

This knowledgebase explains how to create a cronjob through Parallels Plesk Panel.

A cronjob is another word for a scheduled task which allows you to run a command at a specific time or at a specified interval. The interval can range from multiple times a day, daily, weekly, monthly, etc. Within Plesk, cronjobs are scheduled using the Crontab.

A few features in Magento require a script to be run periodically. These features include, but are not limited to:

  • Catalog Price rules
  • Sending Newsletters
  • Generating Google Sitemaps
  • Customer Alerts/Notifications (product price change, product back to stock)
  • Automatic updating of currency rates
  • Scheduled DB logs cleanup

To create a cronjob specifically to run a Magento cron job (every 5 minutes), do the following:

1. Login to your Parallels Plesk Panel and navigate to your domain
2. In the Additional Tools section click the Scheduled Tasks icon
3. Select your username under System User and click Next
4. Click the Schedule New Task button
5. Enter the following:

Minute: */5
Hour: *
Day of the Month: *
Month: *
Day of the Week: *
Command: php -q /var/www/vhosts/example.co.nz/httpdocs/cron.php

Important: The path entered in the Command field needs to match where your cron.php script is located for your installation. The above command will only work if cron.php is owned by apache.apache or if full executable permissions are set for cron.php (0777) if the file permissions are set to the normal user (e.g. example.psacln). As a more foolproof alternative, use the following command instead (especially if you run the magento_cleanup.php script often):

Command: curl -s -o /dev/null http://www.example.co.nz/cron.php


6. Click OK
7. You should now see the following cron:

*/5    *    *    *    *    php -q /var/www/vhosts/example.co.nz/httpdocs/cron.php

or

*/5    *    *    *    *    curl -s -o /dev/null http://www.example.co.nz/cron.php

8. Click Preferences in the Tools Section above
9. In the Send Crontab messages to e-mail address field, enter your referred email address to receive error messages related to your cron script (very important). Click OK.

You have now setup a cron job to run the Magento cron every 5 minutes. Be sure to check your email for any errors. The most common error is incorrect permissions on cron.php or on the cache directory (in /var/cache).

Additional Links

How to setup a cron job
How to test if cron is working

If you are a Create Hosting customer on the Magento Hosting Plan, feel free to submit a support ticket and we can take care of this issue for you.


Cette réponse était-elle pertinente?

« Retour