0

I've created a CRON job which I want to launch once a time every day. This cron is sending me an email when it's launching.

See my crontab.xml

    <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="custom_cronjob" instance="Portail\Cron\Cron\Test" method="execute">
            <!-- every minutes -->
            <!--<schedule>* * * * *</schedule>-->
            <!-- every days -->
            <schedule>0 0 * * *</schedule>
            <config_path>system/config/path</config_path>
        </job>
    </group>
</config>

But I'm not receiving any email.

Do I need to change the schedule ?

When I manually run cron:run group="default" my email is sended.

| improve this question | | | | |
0

You might to set the cron on the server to actually trigger this Magento Cron. To see if you have set or not try running crontab -l and to add a new cron or edit try crontab -e. Also please make sure the web user and the cron user are same otherwise there can be permission issue. If the webserver is run by a different user then you can switch user and edit the cron. Also, please keep in mind that if the server cron is not running every minute then please set it to run every minute like * * * * * bin/magento cron:run

| improve this answer | | | | |
  • I think I don't understand, why do I need to manualy create a file to run the cron ? – Morgan Tartreau Apr 3 at 12:51
  • I never said create a file but I said set the cron on the server to run as automated job every minute. Maybe you can google it also for how to set the cron on ubuntu/redhat/amazonlinux server – Arif Ahmad Apr 4 at 14:08

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.