3

I've been consulting my cron jobs and they all have status pending, what do I have to do to perform these pending tasks?

Select * from cron_schedule
  • do you have cPanel ? – Pawan Mar 14 at 4:05
0

Once these lines are added to the cron table in the operating system, the cron jobs should be executed automatically:

* * * * * /path/to/magento/cron.sh cron.php -mdefault
* * * * * /path/to/magento/cron.sh cron.php -malways

This information is from https://devdocs.magento.com/guides/m1x/install/installing_install.html#install-cron

In order to try it out manually and check for possible problems, you could run it manually via command line, which is, obviously, not a permanent solution:

/path/to/magento/cron.sh cron.php -mdefault
/path/to/magento/cron.sh cron.php -malways
  • when i execut this command i get this erro " -bash: api.php: command not found " – Yuri Rodrigues Mar 13 at 22:22
  • Do you have permissions to run php scripts via cli on the server you work with? – where Mar 13 at 22:29
  • yes, i have permission – Yuri Rodrigues Mar 13 at 22:38
  • what's your operating system? – where Mar 13 at 23:03
  • hi, im using centos 7 – Yuri Rodrigues Mar 14 at 0:24
0

Open shell (Command line) of your server

Run sudo cat /etc/crontab (for CentOS) to open crontab, and add following lines to schedule your cronjobs.

* * * * * /usr/bin/php7.1 /RootDirectory/YouProjectDirectory/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /RootDirectory/YouProjectDirectory/var/log/magent$
* * * * * /usr/bin/php7.1 /RootDirectory/YouProjectDirectory/update/cron.php >> /RootDirectory/YouProjectDirectory/var/log/update.cron.log
* * * * * /usr/bin/php7.1 /RootDirectory/YouProjectDirectory/bin/magento setup:cron:run >> /RootDirectory/YouProjectDirectory/var/log/setup.cron.log

Save file after after adding above lines

Note: RootDirectory is your server root path and YouProjectDirectory is your magento root directory

Here is cron scheduling tutorial: https://www.rosehosting.com/blog/automate-system-tasks-using-cron-on-centos-7/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.