0

Magento 2.4.2-p1

I'm trying to set up the cron job that does the Order Confirmation Emails via cPanel. In our Magento 1.9.4, it looks like this:

/opt/cpanel/ea-php70/root/usr/bin/php /home/ourOLDaccount/public_html/cron.php > /dev/null

while we also have these cron jobs in there as well:

/opt/cpanel/ea-php70/root/usr/bin/php /home/ourOLDaccount/ourOLDwebsite.com/cron.php > /dev/null

/usr/local/bin/php /home/ourOLDaccount/ourOLDwebsite.com/cron.php > /dev/null

In our new Magento 2.4.2-p1 we have the following (I wonder if that was put in there by Amasty when they installed their extensions):

/opt/cpanel/ea-php74/root/usr/bin/php /home/ourNEWaccount/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/ourNEWaccount/public_html/var/log/magento.cron.log

and I have added the following inspired by what we had in the other account on the same server in Magento 1.9.4:

/opt/cpanel/ea-php74/root/usr/bin/php /home/ourNEWaccount/public_html/cron.php > /dev/null

our hosting support on chat also thought this might be OK instead of the above?

/usr/local/bin/ea-php74/php74/root/usr/bin/php /home/ourNEWaccount/public_html/cron.php > /dev/null

The issue is that it's not working! (Order Confirmation Emails and Contact Us messages do not get sent out). Hosting support says this is likely due to the fact that we have a cron.php file that this refers to in public_html on the old Magento 1.9.4 account but not on our new Magento 2.4.2-p1! How does this suppose to work? Can I just take that file from Magento 1.9.4 and copy it over to public_html on the new Magento 2.4.2-p1? Also, will this make the Contact Us form work or does that work via a Sendmail program of sorts?

I did check

Stores > Configuration > Advanced > System

and that's all there.


Updated on August 31st, 2021:

I have copied the cron.php and cron.sh from the old Magento 1.9.4 system over to the new one (Magento 2.4.2-p1) but it doesn't seem to be working still.

1
  • why cPanel ? You can directly do it using command line.try php bin/magento cron:install
    – Pawan
    Aug 31, 2021 at 12:45

2 Answers 2

0

@Allysin, If you are owner of your system Owner means root user than you can create easily cron job using this reference link: Click here to see magento official

2
  • What do you mean by system Owner? We have a VPS server with different accounts. I can connect via SSH as either the account where Magento 2.4.2-p1 is or via the root to the whole server (where I will see other accounts in our VPS also). Would you please advise which one? Thank you.
    – Allysin
    Aug 31, 2021 at 14:52
  • @Allysin if you are talking about VPS server than follow this link bsscommerce.com/blog/setup-cron-jobs-in-magento-2 in above link you can setup cron job from CPANEL or from Setup Cron Jobs Via SSH, ask me if you are still confuse Aug 31, 2021 at 15:11
0

You need to follow below steps:

execute command

magento cron:install

crontab -e

now an entry for your cronjob

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

and now execute the command

php bin/magento setup:cron:run
2
  • Thank you for your step-by-step. I prefer easy-to-implement solutions and yours appear easier than the rest. Just one question please - "now an entry for your cronjob" - is that the bit I put in Cron jobs in the cPanel? If not, where do I plug that into? Thank you.
    – Allysin
    Aug 31, 2021 at 14:54
  • There are 2 options for that either you can set up it from the terminal or from the Cpanel. if you want to do that from the terminal execute the "crontab -e" command and it will open your crontab file where you can put an entry or you can set up it from the Cpanel cronjob section. Vote up if it works Thank You
    – mjsachan
    Sep 1, 2021 at 4:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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