0

Dear All,
I have an application where I have to time to time keep checking the db if there is any update I got to run some function. So what is recommended cron job or php daemon.

3
Contributors
6
Replies
8
Views
6 Years
Discussion Span
Last Post by mslade
0

Crontab is fine but it only allows you to run a PHP file every minute or so.

=> What if the previous run hasn't finished yet? Overlap can seriously damage your data & cause siginificant load on your machines.
=> What if you can't afford to wait a minute for the cronjob to run? Maybe you need to trigger a process the moment a record is inserted?
=> What if you want to keep track of multiple 'runs' and store data in memory.
=> What if you need to keep your application listening (on a socket for example) Cronjobs are a bit rude for this, they may spin out of control and don't provide a framework for logging, etc.
Creating a daemon would offer more elegance & possibilities.

0

Dear Adkhan,
Yes the overalapping problem is what I am worried in crontab. So what is the workaround the daemon? Where to get start any idea please?

0

Dear Adkhan,
I have read before this but is a bit too complex it does not give you some basis. Is there any place to start from the very basis. I read some place it says there is danger with the php_daemon as eats up a lot of memory is that true? Thank you.

0

Frankly speaking I am also a newbie and still learning about it, so can't tell you more details :)

0

Dear Adkhan,
Yes the overalapping problem is what I am worried in crontab. So what is the workaround the daemon? Where to get start any idea please?

You can use crontab and still avoid concurrency problems using something like Semaphores: http://www.php.net/manual/en/book.sem.php

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.