cancel
Showing results for 
Search instead for 
Did you mean: 

Make sure your Magento cron job is running.

Make sure your Magento cron job is running.

 

System messages

 

So, i created cron jobs:

 

 

 

 

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
* * * * * /usr/bin/php /var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log

* * * * * /usr/bin/php /var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log

* * * * *  /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.log


 

 

with this

 

caner@vegan:/var/www/html/magento$ crontab -u caner -e

also tried as root

 

caner@vegan:/var/www/html/magento$ sudo su
root@vegan:/var/www/html/magento# crontab -u caner -e
crontab: installing new crontab
root@vegan:/var/www/html/magento# exit
exit

So whaat is proble m?

 

edit:

 

my urls're wrong so i change t this

 

* * * * * /usr/bin/php /var/www/html/magento/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/magento /var/log/magento.cron.log

* * * * * /usr/bin/php /var/www/html/magento/update/cron.php >> /var/www/html/magento /var/log/update.cron.log

* * * * * /usr/bin/php /var/www/html/magento/bin/magento setup:cron:run >> /var/www/html/magento/var/log/setup.cron.log




and restarted apache bu still same.

 

further dit:

 i changed again to this

 

* * * * * /usr/bin/php /var/www/html/magento/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/magento/var/log/magento.cron.log

* * * * * /usr/bin/php /var/www/html/magento/update/cron.php >> /var/www/html/magento/var/log/update.cron.log

* * * * * /usr/bin/php /var/www/html/magento/bin/magento setup:cron:run >> /var/www/html/magento/var/log/setup.cron.log

 

but still same.

 

 

also

 

caner@vegan:/var/www/html/magento$ php bin/magento indexer:reindex
Command line user does not have read and write permissions on var/generation directory.  Please address this issue before using Magento command line.
caner@vegan:/var/www/html/magento$ sudo php bin/magento indexer:reindex
PHP Fatal error:  Uncaught Error: Call to undefined function Magento\Framework\Event\mb_strtolower() in /var/www/html/magento/vendor/magento/framework/Event/Manager.php:56
Stack trace:
#0 /var/www/html/magento/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('model_load_befo...', Array)
#1 /var/www/html/magento/vendor/magento/framework/Model/AbstractModel.php(562): Magento\Framework\Event\Manager\Proxy->dispatch('model_load_befo...', Array)
#2 /var/www/html/magento/vendor/magento/framework/Model/AbstractModel.php(530): Magento\Framework\Model\AbstractModel->_beforeLoad('1', NULL)
#3 /var/www/html/magento/vendor/magento/module-store/Model/Store.php(488): Magento\Framework\Model\AbstractModel->load('1', NULL)
#4 /var/www/html/magento/var/generation/Magento/Store/Model/Store/Interceptor.php(24): Magento\Store\Model\Store->load('1', NULL)
#5 /var/www/html/magento/vendor/magento/module-store/Model/StoreRepository.php(89): Magento\Store\Model\Store\Interceptor->load('1')
#6 /var in /var/www/html/magento/vendor/magento/framework/Event/Manager.php on line 56

 

 

also

 

root@vegan:/var/www/html/magento# bin/magento setup:upgrade
PHP Fatal error:  Uncaught Error: Call to undefined function Magento\Framework\Event\mb_strtolower() in /var/www/html/magento/vendor/magento/framework/Event/Manager.php:56
Stack trace:
#0 /var/www/html/magento/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('adminhtml_cache...', Array)
#1 /var/www/html/magento/vendor/magento/module-page-cache/Model/Cache/Type.php(48): Magento\Framework\Event\Manager\Proxy->dispatch('adminhtml_cache...')
#2 /var/www/html/magento/vendor/magento/framework/App/Cache/TypeList.php(183): Magento\PageCache\Model\Cache\Type->clean()
#3 /var/www/html/magento/vendor/magento/framework/App/Cache/Manager.php(88): Magento\Framework\App\Cache\TypeList->cleanType('full_page')
#4 /var/www/html/magento/setup/src/Magento/Setup/Model/Installer.php(1080): Magento\Framework\App\Cache\Manager->clean(Array)
#5 /var/www/html/magento/setup/src/Magento/Setup/Model/Installer.php(1011): Magento\Setup\Model\Installer->cleanCaches()
#6 /var/www/html/magento/setup/src/Ma in /var/www/html/magento/vendor/magento/framework/Event/Manager.php on line 56
root@vegan:/var/www/html/magento# php bin\magento indexer:reindex
Could not open input file: binmagento
root@vegan:/var/www/html/magento# cd /b
bin/  boot/ 
root@vegan:/var/www/html/magento# cd /bin/
root@vegan:/bin# php .\magento indexer:reindex
Could not open input file: .magento
root@vegan:/bin# 

it doesnot work too with root.

2 REPLIES 2

Re: Make sure your Magento cron job is running.

I've got the same issue... no resolution in sight!

Re: Make sure your Magento cron job is running.

It looks like there are a couple of issues that you are currently running into:

 

1.) mb_strtolower() is missing - please make sure that the PHP extension mbstring is installed. If you are not managing your server your webhost can assist with this.

 

2.) permission issues - please make sure that you are setting up the cronjob under the same user that owns the files. If you run `ls -al` you would get something like

 

 

rwxr-xr-x  5 jenkins www-data   4096 Feb  3 10:35 app
drwxr-xr-x  2 jenkins www-data   4096 Jan 22 23:21 bin
-rw-r--r--  1 jenkins www-data 438803 Jan 22 22:45 CHANGELOG.md
-rw-r--r--  1 jenkins www-data   2403 Feb  3 07:12 composer.json
-rw-r--r--  1 jenkins www-data 329770 Feb  3 07:14 composer.lock
-rw-r--r--  1 jenkins www-data   3425 Jan 22 22:45 CONTRIBUTING.md
-rw-r--r--  1 jenkins www-data  10011 Jan 22 22:45 CONTRIBUTOR_LICENSE_AGREEMENT.html
-rw-r--r--  1 jenkins www-data    631 Jan 22 22:45 COPYING.txt
drwxr-xr-x  4 jenkins www-data   4096 Jan 22 23:21 dev
-rw-r--r--  1 jenkins www-data   1032 Mar 31  2016 .gitignore
-rw-r--r--  1 jenkins www-data   2926 Jan 22 22:45 Gruntfile.js
-rw-r--r--  1 jenkins www-data   7592 Jan 22 22:45 .htaccess
-rw-r--r--  1 jenkins www-data   6419 Jan 22 22:45 .htaccess.sample
-rw-r--r--  1 jenkins www-data   1358 Jan 22 22:45 index.php
drwxr-xr-x  4 jenkins www-data   4096 Feb  3 10:21 lib
-rw-r--r--  1 jenkins www-data  10376 Jan 22 22:45 LICENSE_AFL.txt
-rw-r--r--  1 jenkins www-data  10364 Jan 22 22:45 LICENSE.txt
-rw-r--r--  1 jenkins www-data   4108 Jan 22 22:45 nginx.conf.sample
-rw-r--r--  1 jenkins www-data   1427 Jan 22 22:45 package.json
-rw-r--r--  1 jenkins www-data   1659 Jan 22 22:45 .php_cs
-rw-r--r--  1 jenkins www-data    804 Jan 22 22:45 php.ini.sample
drwxr-xr-x  2 jenkins www-data   4096 Jan 22 23:20 phpserver
drwxr-xr-x  6 jenkins www-data   4096 Jan 22 23:20 pub
-rw-r--r--  1 jenkins www-data   4388 Mar 31  2016 README.md
drwxr-xr-x  7 jenkins www-data   4096 Jan 22 23:20 setup
-rw-r--r--  1 jenkins www-data   3731 Jan 22 22:45 .travis.yml
drwxr-xr-x  7 jenkins www-data   4096 Jan 22 23:20 update
drwxr-xr-x  9 jenkins www-data   4096 Feb  3 08:10 var
drwxr-xr-x 30 jenkins www-data   4096 Feb  3 08:12 vendor

so in my case I would set up the cronjob for the user 'jenkins'.

 

 

The easiest would be to first confirm your command is working by running it directly from the command line:

 

sudo -u www-data 'php bin/magento cron:run'

The sudo command will run the command as the specified user - www-data in this case. Change it to what you worked out above with the ls command.