How can I check Cronjob is working and make it work?












1















I setup cronjob on server's crontab



*/5 * * * * /home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1

30 3 * * * php /home/users/mydomain/www/shell/indexer.php --reindex catalog_url


it seems working on server



[root@ /var/log]# grep '/home/users/mydomain/www/cron.php' cron

May 10 16:00:01 crond[21592]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:05:01 crond[21718]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:10:01 crond[21766]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)


but when I check the cron scheduler module I can see that cronjob is not working




Last heartbeat is older than one hour. Please check your settings and
your configuration!




Both cronjob and scheduler works well before I moved my all files to other folders



How can I check Cronjob is working and make it work?










share|improve this question























  • This might help you out. help.sweettoothrewards.com/article/…

    – Sukeshini
    May 11 '15 at 1:57






  • 1





    Possible duplicate of How to run cron job

    – Teja Bhagavan Kollepara
    Sep 27 '16 at 10:14
















1















I setup cronjob on server's crontab



*/5 * * * * /home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1

30 3 * * * php /home/users/mydomain/www/shell/indexer.php --reindex catalog_url


it seems working on server



[root@ /var/log]# grep '/home/users/mydomain/www/cron.php' cron

May 10 16:00:01 crond[21592]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:05:01 crond[21718]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:10:01 crond[21766]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)


but when I check the cron scheduler module I can see that cronjob is not working




Last heartbeat is older than one hour. Please check your settings and
your configuration!




Both cronjob and scheduler works well before I moved my all files to other folders



How can I check Cronjob is working and make it work?










share|improve this question























  • This might help you out. help.sweettoothrewards.com/article/…

    – Sukeshini
    May 11 '15 at 1:57






  • 1





    Possible duplicate of How to run cron job

    – Teja Bhagavan Kollepara
    Sep 27 '16 at 10:14














1












1








1








I setup cronjob on server's crontab



*/5 * * * * /home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1

30 3 * * * php /home/users/mydomain/www/shell/indexer.php --reindex catalog_url


it seems working on server



[root@ /var/log]# grep '/home/users/mydomain/www/cron.php' cron

May 10 16:00:01 crond[21592]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:05:01 crond[21718]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:10:01 crond[21766]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)


but when I check the cron scheduler module I can see that cronjob is not working




Last heartbeat is older than one hour. Please check your settings and
your configuration!




Both cronjob and scheduler works well before I moved my all files to other folders



How can I check Cronjob is working and make it work?










share|improve this question














I setup cronjob on server's crontab



*/5 * * * * /home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1

30 3 * * * php /home/users/mydomain/www/shell/indexer.php --reindex catalog_url


it seems working on server



[root@ /var/log]# grep '/home/users/mydomain/www/cron.php' cron

May 10 16:00:01 crond[21592]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:05:01 crond[21718]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)
May 10 16:10:01 crond[21766]: (root) CMD (/home/users/mydomain/www/cron.php >> /home/users/mydomain/www/var/log/cron.log 2>&1)


but when I check the cron scheduler module I can see that cronjob is not working




Last heartbeat is older than one hour. Please check your settings and
your configuration!




Both cronjob and scheduler works well before I moved my all files to other folders



How can I check Cronjob is working and make it work?







cron






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 11 '15 at 0:45









MoonMoon

73672243




73672243













  • This might help you out. help.sweettoothrewards.com/article/…

    – Sukeshini
    May 11 '15 at 1:57






  • 1





    Possible duplicate of How to run cron job

    – Teja Bhagavan Kollepara
    Sep 27 '16 at 10:14



















  • This might help you out. help.sweettoothrewards.com/article/…

    – Sukeshini
    May 11 '15 at 1:57






  • 1





    Possible duplicate of How to run cron job

    – Teja Bhagavan Kollepara
    Sep 27 '16 at 10:14

















This might help you out. help.sweettoothrewards.com/article/…

– Sukeshini
May 11 '15 at 1:57





This might help you out. help.sweettoothrewards.com/article/…

– Sukeshini
May 11 '15 at 1:57




1




1





Possible duplicate of How to run cron job

– Teja Bhagavan Kollepara
Sep 27 '16 at 10:14





Possible duplicate of How to run cron job

– Teja Bhagavan Kollepara
Sep 27 '16 at 10:14










4 Answers
4






active

oldest

votes


















4














Take a view to your MySQL Database > table cron_schedule. There are all magento created jobs with timestamp of creation, scheduled, executed and their status.



If anything wrong, then look for the cron job in the table and see if there is any log in the messages column.






share|improve this answer

































    0














    */5 * * * * sh /home/users/mydomain/www/cron.sh >> /home/users/mydomain/www/var/log/cron.log 2>&1


    Use cron.sh, not cron.php, which you will need php for.






    share|improve this answer


























    • This makes more sense to me than using cron.php, working on this now, I'll let you know if it works!

      – dustbuster
      Oct 22 '18 at 21:22











    • cron.sh is not supported. see: devdocs.magento.com/guides/v2.0/config-guide/cli/…

      – Saturn Technologies
      Nov 21 '18 at 17:53



















    0














    First of all, check that whether your cron is scheduled or not, to check this run your cron, as cron runs it makes the entry in database, if you find that entry in your database that means your cron is scheduled correctly.



    And if it is scheduled correctly but not running, in this case there may be two possibilities-
    First is you may have written the wrong file path where the cron has to be run, or
    You have made some mistakes on the piece of code where you have called the cron function. To check this you can apply the logger on that code to find the error that why your cron is not working. As you apply the logger, it will make a log file /var/log/ in the magento root directory through which you can find the error.






    share|improve this answer































      0














      I am also facing same issue.Cron job is not doing its job to backup in magento2.
      I have checked in cron_schedule as suggested by SFrey.Field values are



      | schedule_id | job_code| status | messages| created_at| scheduled_at|executed_at| finished_at|



      1318 | ddg_automation_campaign| missed | Too late for the schedule| 2019-01-17 07:52:14 | 2019-01-17 07:55:00 | NULL| NULL|



      Please help me.






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "479"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f67336%2fhow-can-i-check-cronjob-is-working-and-make-it-work%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        4














        Take a view to your MySQL Database > table cron_schedule. There are all magento created jobs with timestamp of creation, scheduled, executed and their status.



        If anything wrong, then look for the cron job in the table and see if there is any log in the messages column.






        share|improve this answer






























          4














          Take a view to your MySQL Database > table cron_schedule. There are all magento created jobs with timestamp of creation, scheduled, executed and their status.



          If anything wrong, then look for the cron job in the table and see if there is any log in the messages column.






          share|improve this answer




























            4












            4








            4







            Take a view to your MySQL Database > table cron_schedule. There are all magento created jobs with timestamp of creation, scheduled, executed and their status.



            If anything wrong, then look for the cron job in the table and see if there is any log in the messages column.






            share|improve this answer















            Take a view to your MySQL Database > table cron_schedule. There are all magento created jobs with timestamp of creation, scheduled, executed and their status.



            If anything wrong, then look for the cron job in the table and see if there is any log in the messages column.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jun 19 '17 at 4:13









            Fra

            4,515114793




            4,515114793










            answered Oct 11 '15 at 17:43









            SFreySFrey

            1068




            1068

























                0














                */5 * * * * sh /home/users/mydomain/www/cron.sh >> /home/users/mydomain/www/var/log/cron.log 2>&1


                Use cron.sh, not cron.php, which you will need php for.






                share|improve this answer


























                • This makes more sense to me than using cron.php, working on this now, I'll let you know if it works!

                  – dustbuster
                  Oct 22 '18 at 21:22











                • cron.sh is not supported. see: devdocs.magento.com/guides/v2.0/config-guide/cli/…

                  – Saturn Technologies
                  Nov 21 '18 at 17:53
















                0














                */5 * * * * sh /home/users/mydomain/www/cron.sh >> /home/users/mydomain/www/var/log/cron.log 2>&1


                Use cron.sh, not cron.php, which you will need php for.






                share|improve this answer


























                • This makes more sense to me than using cron.php, working on this now, I'll let you know if it works!

                  – dustbuster
                  Oct 22 '18 at 21:22











                • cron.sh is not supported. see: devdocs.magento.com/guides/v2.0/config-guide/cli/…

                  – Saturn Technologies
                  Nov 21 '18 at 17:53














                0












                0








                0







                */5 * * * * sh /home/users/mydomain/www/cron.sh >> /home/users/mydomain/www/var/log/cron.log 2>&1


                Use cron.sh, not cron.php, which you will need php for.






                share|improve this answer















                */5 * * * * sh /home/users/mydomain/www/cron.sh >> /home/users/mydomain/www/var/log/cron.log 2>&1


                Use cron.sh, not cron.php, which you will need php for.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 11 '15 at 1:25

























                answered May 11 '15 at 1:20









                AnonymousAnonymous

                39917




                39917













                • This makes more sense to me than using cron.php, working on this now, I'll let you know if it works!

                  – dustbuster
                  Oct 22 '18 at 21:22











                • cron.sh is not supported. see: devdocs.magento.com/guides/v2.0/config-guide/cli/…

                  – Saturn Technologies
                  Nov 21 '18 at 17:53



















                • This makes more sense to me than using cron.php, working on this now, I'll let you know if it works!

                  – dustbuster
                  Oct 22 '18 at 21:22











                • cron.sh is not supported. see: devdocs.magento.com/guides/v2.0/config-guide/cli/…

                  – Saturn Technologies
                  Nov 21 '18 at 17:53

















                This makes more sense to me than using cron.php, working on this now, I'll let you know if it works!

                – dustbuster
                Oct 22 '18 at 21:22





                This makes more sense to me than using cron.php, working on this now, I'll let you know if it works!

                – dustbuster
                Oct 22 '18 at 21:22













                cron.sh is not supported. see: devdocs.magento.com/guides/v2.0/config-guide/cli/…

                – Saturn Technologies
                Nov 21 '18 at 17:53





                cron.sh is not supported. see: devdocs.magento.com/guides/v2.0/config-guide/cli/…

                – Saturn Technologies
                Nov 21 '18 at 17:53











                0














                First of all, check that whether your cron is scheduled or not, to check this run your cron, as cron runs it makes the entry in database, if you find that entry in your database that means your cron is scheduled correctly.



                And if it is scheduled correctly but not running, in this case there may be two possibilities-
                First is you may have written the wrong file path where the cron has to be run, or
                You have made some mistakes on the piece of code where you have called the cron function. To check this you can apply the logger on that code to find the error that why your cron is not working. As you apply the logger, it will make a log file /var/log/ in the magento root directory through which you can find the error.






                share|improve this answer




























                  0














                  First of all, check that whether your cron is scheduled or not, to check this run your cron, as cron runs it makes the entry in database, if you find that entry in your database that means your cron is scheduled correctly.



                  And if it is scheduled correctly but not running, in this case there may be two possibilities-
                  First is you may have written the wrong file path where the cron has to be run, or
                  You have made some mistakes on the piece of code where you have called the cron function. To check this you can apply the logger on that code to find the error that why your cron is not working. As you apply the logger, it will make a log file /var/log/ in the magento root directory through which you can find the error.






                  share|improve this answer


























                    0












                    0








                    0







                    First of all, check that whether your cron is scheduled or not, to check this run your cron, as cron runs it makes the entry in database, if you find that entry in your database that means your cron is scheduled correctly.



                    And if it is scheduled correctly but not running, in this case there may be two possibilities-
                    First is you may have written the wrong file path where the cron has to be run, or
                    You have made some mistakes on the piece of code where you have called the cron function. To check this you can apply the logger on that code to find the error that why your cron is not working. As you apply the logger, it will make a log file /var/log/ in the magento root directory through which you can find the error.






                    share|improve this answer













                    First of all, check that whether your cron is scheduled or not, to check this run your cron, as cron runs it makes the entry in database, if you find that entry in your database that means your cron is scheduled correctly.



                    And if it is scheduled correctly but not running, in this case there may be two possibilities-
                    First is you may have written the wrong file path where the cron has to be run, or
                    You have made some mistakes on the piece of code where you have called the cron function. To check this you can apply the logger on that code to find the error that why your cron is not working. As you apply the logger, it will make a log file /var/log/ in the magento root directory through which you can find the error.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jun 19 '17 at 11:50









                    CedCommerceCedCommerce

                    53239




                    53239























                        0














                        I am also facing same issue.Cron job is not doing its job to backup in magento2.
                        I have checked in cron_schedule as suggested by SFrey.Field values are



                        | schedule_id | job_code| status | messages| created_at| scheduled_at|executed_at| finished_at|



                        1318 | ddg_automation_campaign| missed | Too late for the schedule| 2019-01-17 07:52:14 | 2019-01-17 07:55:00 | NULL| NULL|



                        Please help me.






                        share|improve this answer




























                          0














                          I am also facing same issue.Cron job is not doing its job to backup in magento2.
                          I have checked in cron_schedule as suggested by SFrey.Field values are



                          | schedule_id | job_code| status | messages| created_at| scheduled_at|executed_at| finished_at|



                          1318 | ddg_automation_campaign| missed | Too late for the schedule| 2019-01-17 07:52:14 | 2019-01-17 07:55:00 | NULL| NULL|



                          Please help me.






                          share|improve this answer


























                            0












                            0








                            0







                            I am also facing same issue.Cron job is not doing its job to backup in magento2.
                            I have checked in cron_schedule as suggested by SFrey.Field values are



                            | schedule_id | job_code| status | messages| created_at| scheduled_at|executed_at| finished_at|



                            1318 | ddg_automation_campaign| missed | Too late for the schedule| 2019-01-17 07:52:14 | 2019-01-17 07:55:00 | NULL| NULL|



                            Please help me.






                            share|improve this answer













                            I am also facing same issue.Cron job is not doing its job to backup in magento2.
                            I have checked in cron_schedule as suggested by SFrey.Field values are



                            | schedule_id | job_code| status | messages| created_at| scheduled_at|executed_at| finished_at|



                            1318 | ddg_automation_campaign| missed | Too late for the schedule| 2019-01-17 07:52:14 | 2019-01-17 07:55:00 | NULL| NULL|



                            Please help me.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 20 mins ago









                            CharanjeetCharanjeet

                            133




                            133






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Magento Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f67336%2fhow-can-i-check-cronjob-is-working-and-make-it-work%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Polycentropodidae

                                Magento 2 Error message: Invalid state change requested

                                Paulmy