How do I make sure my Magento cron job is running? I setup cron per the Magento 2 installation instructions for the log files.
See screen shot (click to enlarge):
I am running Magento CE 2.0.2
Server Platform:
- Operating System: CENTOS 7.2 x86_64
- CPU: Dual Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
- RAM: 256 GB
- Storage: SSD Based Cloud Storage
- Network: 20 Gigabits
- Server UI: cPanel/WHM 54.0 Build 18 (latest/stable)
- Apache: 2.2.26
- MySQL: 5.6.29
- PHP: 5.6.18
Crontab for the cPanel user host account:
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/abcdefg/public_html/bin/magento cron:run > /home/abcdefg/public_html/var/log/magento.cron.log&
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/abcdefg/public_html/update/cron.php > /home/abcdefg/public_html/var/log/update.cron.log&
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/abcdefg/public_html/bin/magento setup:cron:run > /home/abcdefg/public_html/var/log/setup.cron.log&
Added 2016-05-05
I was informed that the MySQL cron_schedule
contains cron activity. So I looked at the table and found these entries. Here is a snippet of each of the unique entries in that table showing their latest entry.
55534 aggregate_sales_report_coupons_data running Class Magento\SalesRule\Crone\AggregateSalesReportCouponsData does not exist 2016-05-04 19:54:02 2016-05-04 20:00:00 NULL NULL
56093 captcha_delete_expired_images success NULL 2016-05-05 07:06:03 2016-05-05 07:10:00 2016-05-05 07:10:02 2016-05-05 07:10:02
56081 captcha_delete_old_attempts success NULL 2016-05-05 06:51:02 2016-05-05 07:00:00 2016-05-05 07:00:03 2016-05-05 07:00:03
56070 catalog_index_refresh_price success NULL 2016-05-05 06:51:02 2016-05-05 07:00:00 2016-05-05 07:00:03 2016-05-05 07:00:03
56094 magento_newrelicreporting_cron success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56092 newsletter_send_all success NULL 2016-05-05 07:06:03 2016-05-05 07:10:00 2016-05-05 07:10:02 2016-05-05 07:10:02
56071 sales_clean_orders success NULL 2016-05-05 06:51:02 2016-05-05 07:00:00 2016-05-05 07:00:03 2016-05-05 07:00:03
56084 sales_grid_order_async_insert success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56087 sales_grid_order_creditmemo_async_insert success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56085 sales_grid_order_invoice_async_insert success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56086 sales_grid_order_shipment_async_insert success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56091 sales_send_order_creditmemo_emails success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56088 sales_send_order_emails success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56089 sales_send_order_invoice_emails success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
56090 sales_send_order_shipment_emails success NULL 2016-05-05 07:06:03 2016-05-05 07:06:00 2016-05-05 07:07:03 2016-05-05 07:07:03
Also, how can I get the 3 log file crons to run that I setup upon initial install:
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/abcdefg/public_html/bin/magento cron:run >> /home/abcdefg/public_html/var/log/magento.cron.log&
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/abcdefg/public_html/update/cron.php >> /home/abcdefg/public_html/var/log/update.cron.log&
*/1 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/abcdefg/public_html/bin/magento setup:cron:run >> /home/abcdefg/public_html/var/log/setup.cron.log&
Finally, I remember a few years back when I installed a Magento instance for a client in Magento v1 that somehow the pages index & cache and product index & cache got updated automatically through cron somehow. How can I get Magento 2 to do that same thing? Every time I login into Magento 2 in the Admin UI backend, I need to reindex & flush cache so my client's products can appear on the site.
Test of 2016-05-05 at 12:05 p.m. ET
(1) I truncated the cron_schedule
table. Then after 1 minute here is the new table:
Here's the table after cron ran:
Best Answer
Truncate the
cron_schedule
table and see if it gets re-populated with scheduled tasks after a few minutes.Rough, I know, but should give you an answer. Also, maybe it's worth doing this on a staging env. first.
Use:
After a few minutes use: