cancel
Showing results for 
Search instead for 
Did you mean: 

Cron Issues

Cron Issues

i've followed the Magento 2 cron setup documentation and have 1 out of 3 working, two are giving me errors that i can't solve by googling, any help appreciated.

 

Cron1

 

/usr/bin/php -c /var/www/vhosts/system/tbfdirect.co.uk/etc/php.ini /var/www/vhosts/tbfdirect.co.uk/httpdocs/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/vhosts/tbfdirect.co.uk/httpdocs/var/log/magento.cron.log

Fails with: 

Task "/usr/bin/php -c /var/www/vhosts/system/tbfdirect.co.uk/etc/php.ini /var/www/vhosts/tbfdirect.co.uk/httpdocs/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/vhosts/tbfdirect.co.uk/httpdocs/var/log/magento.cron.log" completed with error in 3 seconds, output:

[InvalidArgumentException]
There are no commands defined in the "cron" namespace.

 

Cron 2

 

/usr/bin/php -c /var/www/vhosts/system/tbfdirect.co.uk/etc/php.ini /var/www/vhosts/tbfdirect.co.uk/httpdocs/update/cron.php >> /var/www/vhosts/tbfdirect.co.uk/httpdocs/var/log/update.cron.log

Succeeds with no errors

 

Cron 3

 

/usr/bin/php -c /var/www/vhosts/system/tbfdirect.co.uk/etc/php.ini /var/www/vhosts/tbfdirect.co.uk/httpdocs/bin/magento setup:cron:run >> /var/www/vhosts/tbfdirect.co.uk/httpdocs/var/log/setup.cron.log

Fails with: 

Task "/usr/bin/php -c /var/www/vhosts/system/tbfdirect.co.uk/etc/php.ini /var/www/vhosts/tbfdirect.co.uk/httpdocs/bin/magento setup:cron:run >> /var/www/vhosts/tbfdirect.co.uk/httpdocs/var/log/setup.cron.log" completed with error in 1 seconds, output:

[InvalidArgumentException]
There are no commands defined in the "setup:cron" namespace.

2 REPLIES 2

Re: Cron Issues

Hello DanBrad01,

Everything seems fine. may be permission issue of current user try to use the following:

* * * * * sudo /usr/bin/php -c /etc/php5/apache2/php.ini /home/manish/workspace/magento2/bin/magento cron:run >> /home/manish/workspace/magento2/var/log/magento.cron.log
* * * * * sudo  /usr/bin/php -c /etc/php5/apache2/php.ini /home/manish/workspace/magento2/update/cron.php >> /home/manish/workspace/magento2/log/update.cron.log
* * * * * sudo /usr/bin/php -c /etc/php5/apache2/php.ini /home/manish/workspace/magento2/bin/magento setup:cron:run >> /home/manish/workspace/magento2/log/setup.cron.log

 

Re: Cron Issues

I fix it with 777 chmod ..magento2-dir/var

# cd magento2-dir/update

# php cron.php

# cd  ..

 

Run cron 2 times:

# php bin/magento cron:run

php bin/magento cron:run