0

I am hosting my magento 2 shop at all-inkl and unfortunately I can only use a "cgi bridge" to call the cron.php via a web cron job.

I have built that bridge which looks like that:

<?php
exec("/bin/bash cron.php  2>&1", $out, $result);
echo "Returncode: " .$result ."<br>";
echo "Script:" ."<br>";
echo "<pre>"; print_r($out);
?>

my cron.php looks like that:

#~ MAGENTO START
* * * * * /usr/bin/php /www/htdocs/USER/magento2/bin/magento cron:run | grep -v Ran jobs by schedule >> /www/htdocs/USER/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /www/htdocs/USER/magento2/update/cron.php >> /www/htdocs/USER/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /www/htdocs/USER/magento2/bin/magento setup:cron:run >> /www/htdocs/USER/magento2/var/log/setup.cron.log
#~ MAGENTO END

But if I open the bridge file via my browser, I get this error:

Returncode: 127 Script: Array ( [0] => cron.php: line 2: /bin/grep: Permission denied

[1] => cron.php: line 2: CHANGELOG.md: command not found
[2] => cron.php: line 3: CHANGELOG.md: command not found
[3] => cron.php: line 4: CHANGELOG.md: command not found 

)

I have no idea how to get those cron jobs running.

0

Magento 2 cron are run via cli, you can configure the cron as below.

Note: Update paths as your current system.

    <?php
    $output = exec("/opt/lampp/bin/php -d memory_limit=2G  /opt/lampp/htdocs/magento/2.2.4/bin/magento cron:run");
    echo "<pre>"; var_dump($output);
    ?>

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.