Laravel 5 24 hour loop application












0














I'm trying to create a Laravel 5 application that executes a script once every 24 hours, as requested by a client. But since this application isn't supposed to respond to any HTTP requests, i'm not sure how to go about it. What i'm having problems with is the execution of the script, since it won't respond to any requests, how can i execute a script within the context of a Laravel application?



Is that even possible in this framework?










share|improve this question






















  • You could do task scheduling laravel.com/docs/5.7/scheduling
    – Paul Mikki
    Nov 12 '18 at 8:17
















0














I'm trying to create a Laravel 5 application that executes a script once every 24 hours, as requested by a client. But since this application isn't supposed to respond to any HTTP requests, i'm not sure how to go about it. What i'm having problems with is the execution of the script, since it won't respond to any requests, how can i execute a script within the context of a Laravel application?



Is that even possible in this framework?










share|improve this question






















  • You could do task scheduling laravel.com/docs/5.7/scheduling
    – Paul Mikki
    Nov 12 '18 at 8:17














0












0








0







I'm trying to create a Laravel 5 application that executes a script once every 24 hours, as requested by a client. But since this application isn't supposed to respond to any HTTP requests, i'm not sure how to go about it. What i'm having problems with is the execution of the script, since it won't respond to any requests, how can i execute a script within the context of a Laravel application?



Is that even possible in this framework?










share|improve this question













I'm trying to create a Laravel 5 application that executes a script once every 24 hours, as requested by a client. But since this application isn't supposed to respond to any HTTP requests, i'm not sure how to go about it. What i'm having problems with is the execution of the script, since it won't respond to any requests, how can i execute a script within the context of a Laravel application?



Is that even possible in this framework?







php laravel-5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 8:12









Selhar

607




607












  • You could do task scheduling laravel.com/docs/5.7/scheduling
    – Paul Mikki
    Nov 12 '18 at 8:17


















  • You could do task scheduling laravel.com/docs/5.7/scheduling
    – Paul Mikki
    Nov 12 '18 at 8:17
















You could do task scheduling laravel.com/docs/5.7/scheduling
– Paul Mikki
Nov 12 '18 at 8:17




You could do task scheduling laravel.com/docs/5.7/scheduling
– Paul Mikki
Nov 12 '18 at 8:17












2 Answers
2






active

oldest

votes


















2














You COULD create a main loop in PHP and have your script keep running but sleep until it's time to execute your logic again. The downside is that memory management is a bit out of your hands in PHP so it might run out of memory, even if you manually advise the garbage collector to run.



A common solution on Linux is to set up a CRON job or on Windows use the Windows Task Scheduler to setup the script to run once every 24h.



Depending on the script you either run PHP in CLI mode and execute it like any other command line tool. Or you could run CURL or something similar to call a URL to execute your script.






share|improve this answer





























    0














    Laravel framework has inbuilt task schedular.
    So you can use this feature to schedule the task that you want to run once every 24 hours.



    Here is the documentation of how to create a cron job and create a task schedular using laravel https://laravel.com/docs/5.4/scheduling






    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      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: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2fstackoverflow.com%2fquestions%2f53258094%2flaravel-5-24-hour-loop-application%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      You COULD create a main loop in PHP and have your script keep running but sleep until it's time to execute your logic again. The downside is that memory management is a bit out of your hands in PHP so it might run out of memory, even if you manually advise the garbage collector to run.



      A common solution on Linux is to set up a CRON job or on Windows use the Windows Task Scheduler to setup the script to run once every 24h.



      Depending on the script you either run PHP in CLI mode and execute it like any other command line tool. Or you could run CURL or something similar to call a URL to execute your script.






      share|improve this answer


























        2














        You COULD create a main loop in PHP and have your script keep running but sleep until it's time to execute your logic again. The downside is that memory management is a bit out of your hands in PHP so it might run out of memory, even if you manually advise the garbage collector to run.



        A common solution on Linux is to set up a CRON job or on Windows use the Windows Task Scheduler to setup the script to run once every 24h.



        Depending on the script you either run PHP in CLI mode and execute it like any other command line tool. Or you could run CURL or something similar to call a URL to execute your script.






        share|improve this answer
























          2












          2








          2






          You COULD create a main loop in PHP and have your script keep running but sleep until it's time to execute your logic again. The downside is that memory management is a bit out of your hands in PHP so it might run out of memory, even if you manually advise the garbage collector to run.



          A common solution on Linux is to set up a CRON job or on Windows use the Windows Task Scheduler to setup the script to run once every 24h.



          Depending on the script you either run PHP in CLI mode and execute it like any other command line tool. Or you could run CURL or something similar to call a URL to execute your script.






          share|improve this answer












          You COULD create a main loop in PHP and have your script keep running but sleep until it's time to execute your logic again. The downside is that memory management is a bit out of your hands in PHP so it might run out of memory, even if you manually advise the garbage collector to run.



          A common solution on Linux is to set up a CRON job or on Windows use the Windows Task Scheduler to setup the script to run once every 24h.



          Depending on the script you either run PHP in CLI mode and execute it like any other command line tool. Or you could run CURL or something similar to call a URL to execute your script.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 '18 at 8:15









          inquam

          7,343134691




          7,343134691

























              0














              Laravel framework has inbuilt task schedular.
              So you can use this feature to schedule the task that you want to run once every 24 hours.



              Here is the documentation of how to create a cron job and create a task schedular using laravel https://laravel.com/docs/5.4/scheduling






              share|improve this answer


























                0














                Laravel framework has inbuilt task schedular.
                So you can use this feature to schedule the task that you want to run once every 24 hours.



                Here is the documentation of how to create a cron job and create a task schedular using laravel https://laravel.com/docs/5.4/scheduling






                share|improve this answer
























                  0












                  0








                  0






                  Laravel framework has inbuilt task schedular.
                  So you can use this feature to schedule the task that you want to run once every 24 hours.



                  Here is the documentation of how to create a cron job and create a task schedular using laravel https://laravel.com/docs/5.4/scheduling






                  share|improve this answer












                  Laravel framework has inbuilt task schedular.
                  So you can use this feature to schedule the task that you want to run once every 24 hours.



                  Here is the documentation of how to create a cron job and create a task schedular using laravel https://laravel.com/docs/5.4/scheduling







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 12 '18 at 8:33









                  Deepak Kumar T P

                  966716




                  966716






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • 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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2fstackoverflow.com%2fquestions%2f53258094%2flaravel-5-24-hour-loop-application%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







                      這個網誌中的熱門文章

                      Xamarin.form Move up view when keyboard appear

                      Post-Redirect-Get with Spring WebFlux and Thymeleaf

                      Anylogic : not able to use stopDelay()