Git Product home page Git Product logo

Comments (6)

NoUseFreak avatar NoUseFreak commented on May 24, 2024

Hi,

This issue is indeed possible when allowing cron to be triggered from outside the server. If you can you should place a single trigger in your crontab. This way other can not trigger your cron more than you set it.

If you want to make sure you do not run the same job in parallel, you can implement a basic Semaphore that logs/locks the jobs started an releases the job finished/failed.

Hope this answer was of any help.

from cron.

NoUseFreak avatar NoUseFreak commented on May 24, 2024

Note: My implementation at the moment is an abstract of crontab. Crontab will have the same issue.
I don't see any harm in providing a way for users to solve this problem from within the library.

from cron.

ochurlaud avatar ochurlaud commented on May 24, 2024

If you can you should place a single trigger in your crontab

How do you do that ?

Do be sure not to write it twice I wanted to do a $string = exec(crontab -l) and if the line exists, skip the creation of the crontab, else write it.

I must say that I'm a little confused about your answer: should my crontab -l with php user return something?

from cron.

NoUseFreak avatar NoUseFreak commented on May 24, 2024

Your (unix) crontab should have something like:

* * * * * php /path/to/cron.php >/dev/null 2>&1

Inside the cron.php file you initialize the app and trigger the $cron->run() as the example in the readme.
To do this you will probably move your bootstrap code in a separate file and include it in both the webapp and the cron.php.

from cron.

ochurlaud avatar ochurlaud commented on May 24, 2024

Ok, maybe I didn't get the purpose of your bundle. What I wanted is that no one has to create a cronjob by hand: everything should be done by the website itself...

I finally ran 4 exec() to let php create the cron itself...

Thx anyway for your time

from cron.

NoUseFreak avatar NoUseFreak commented on May 24, 2024

Indeed, the library works the other way around. You create one unix cronjob to trigger the library. The library will allow your application to decide when and what jobs are executed.

from cron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.