0

I have a magento2.2.0 based website and I am trying to get the cron jobs running. Used Ubuntu server with no control panel (AWS EC2 hosting). So, I ssh'ed into the instance and went to

sudo crontab -u root -e 

and below is what I have

* * * * * php -c /etc/php/7.0/cli/php.ini var/www/html/***.com/v2/bin/magento cron:run
* * * * * php -c /etc/php/7.0/cli/php.ini var/www/html/***.com/v2/update/cron.php
* * * * * php -c /etc/php/7.0/cli/php.ini var/www/html/***.com/v2/bin/magento setup:cron:run

I edited the cron.php file at the top i have a php mail() tag setup to send me an email when the file is executed so i can know cron is running but after waiting 2 minutes and do not think that cron is running.

Odd thing is when I try to run the cron.php via ssh command line I still am not getting the file to send me an email so idk if its working?

1

You can use "which php" command to see the exact php path running on the server. Use that php path to configure by the SSH user used for the magento not by the root user.

Go to Magento installation and run

crontab -e

* * * * * path_to_php var/www/html/***.com/v2/bin/magento cron:run
* * * * * path_to_php var/www/html/***.com/v2/update/cron.php
* * * * * path_to_php var/www/html/***.com/v2/bin/magento setup:cron:run
0

Try this, Mention the root path of yours, I hope this will work for you.

* * * * * php -f /rootpath/html/bin/magento cron:run  &> /dev/null
* * * * * php -f /rootpath/update/cron.php &> /dev/null
* * * * * php -f /rootpath/bin/magento setup:cron:run &> /dev/null

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.