Prev: Splitting a string ...
Next: ldap_bind() connectivity
From: Midhun Girish on 15 Mar 2010 08:58 rene "a page with an ajax script that kicks off the check-for-recent-events script on the server".. but that method is highly non reliable.... i dont think anyone will take that risk especially for an important web app.... cron or any equivalent which runs on the server must be used instead of that.. Midhun Girish Development Lead MobAlive Technologies On Mon, Mar 15, 2010 at 6:08 PM, Jochem Maas <jochem(a)iamjochem.com> wrote: > Op 3/15/10 12:00 PM, David Hutto schreef: > > On Mon, Mar 15, 2010 at 7:31 AM, Jochem Maas <jochem(a)iamjochem.com> > wrote: > > > >> Op 3/15/10 8:24 AM, Midhun Girish schreef: > >>> Hi , > >>> Just as David Hutto has said,What you need is the cronjob... Make a > >> script > >>> say "check.php" which checks the db to see if any new entries are > made... > >>> and if yes send the mail ... > >>> > >>> now using the cronjob feature in linux os(which will be provided as a > >>> service in your linux hosting cpanel), set a cronjob which calls the " > >>> http://www.yoursite.com/check.php" URL every minute.... now a trigger > >> will > >>> be there every minute to the script and the emails will be send > >> irrespective > >>> of whether anyone is browsing the site or not.... hope it is clear... > >>> > >> > >> use cron - yes > >> have cron call a web URL - no, instead just call the script via the php > CLI > >> sapi, > >> e.g. a cmdline as follows in cron: > >> > >> /usr/env php /path/to/your/check.php &> /dev/null > >> > > > > > > I do believe removing the /dev/null will send error messages during the > > building of the script, correct? > > > > the '&> /dev/null' redirects all output - I kind of make the assumption > that the > script would be logging stuff to a file or something when in production. > > so, yes, remove the redirection when your developing/testing the script. > > >
From: Ashley Sheridan on 15 Mar 2010 08:55 On Mon, 2010-03-15 at 18:28 +0530, Midhun Girish wrote: > rene "a page with an ajax script that kicks off the check-for-recent-events > script on the server".. but that method is highly non reliable.... i dont > think anyone will take that risk especially for an important web app.... > cron or any equivalent which runs on the server must be used instead of > that.. > > > Midhun Girish > Development Lead > MobAlive Technologies > > > > On Mon, Mar 15, 2010 at 6:08 PM, Jochem Maas <jochem(a)iamjochem.com> wrote: > > > Op 3/15/10 12:00 PM, David Hutto schreef: > > > On Mon, Mar 15, 2010 at 7:31 AM, Jochem Maas <jochem(a)iamjochem.com> > > wrote: > > > > > >> Op 3/15/10 8:24 AM, Midhun Girish schreef: > > >>> Hi , > > >>> Just as David Hutto has said,What you need is the cronjob... Make a > > >> script > > >>> say "check.php" which checks the db to see if any new entries are > > made... > > >>> and if yes send the mail ... > > >>> > > >>> now using the cronjob feature in linux os(which will be provided as a > > >>> service in your linux hosting cpanel), set a cronjob which calls the " > > >>> http://www.yoursite.com/check.php" URL every minute.... now a trigger > > >> will > > >>> be there every minute to the script and the emails will be send > > >> irrespective > > >>> of whether anyone is browsing the site or not.... hope it is clear... > > >>> > > >> > > >> use cron - yes > > >> have cron call a web URL - no, instead just call the script via the php > > CLI > > >> sapi, > > >> e.g. a cmdline as follows in cron: > > >> > > >> /usr/env php /path/to/your/check.php &> /dev/null > > >> > > > > > > > > > I do believe removing the /dev/null will send error messages during the > > > building of the script, correct? > > > > > > > the '&> /dev/null' redirects all output - I kind of make the assumption > > that the > > script would be logging stuff to a file or something when in production. > > > > so, yes, remove the redirection when your developing/testing the script. > > > > > > I agree. Even setting a cron on a local computer to call home to a server script would be preferable to Ajax calls. Thanks, Ash http://www.ashleysheridan.co.uk
From: "Alex Major" on 15 Mar 2010 13:38 Thanks to all for your help on this, it's been very interesting for me to read. The system needs to check arrivals in real time (give or take a second or two), using a cron job every minute doesn't provide the real time checking I would like. However, when I then got to thinking about it, wouldn't this be an ideal solution? I create a PHP script that loops for 60 seconds, checking the database each second for new entries and processing them (meaning I get near real time monitoring), and then have that PHP script called by a cron job every minute. The reason I think that could be a good solution for me, is that if the PHP script crashed (for any reason), then at most it's 59 seconds before the system kicks in again and begins processing all the queued arrivals. If I coded a PHP script to loop infinitely processing things every second, it's possible I wouldn't notice a crash for a considerable amount of time. The proposed solution provides a good fail-safe, I think. Does that solution seem sensible? Or overkill? Thanks again for your help in this, it's quite novel for me. -----Original Message----- From: Ashley Sheridan [mailto:ash(a)ashleysheridan.co.uk] Sent: 15 March 2010 12:56 To: Midhun Girish Cc: Jochem Maas; David Hutto; php-general(a)lists.php.net; Alex Major Subject: Re: [PHP] Event Handling On Mon, 2010-03-15 at 18:28 +0530, Midhun Girish wrote: > rene "a page with an ajax script that kicks off the check-for-recent-events > script on the server".. but that method is highly non reliable.... i dont > think anyone will take that risk especially for an important web app.... > cron or any equivalent which runs on the server must be used instead of > that.. > > > Midhun Girish > Development Lead > MobAlive Technologies > > > > On Mon, Mar 15, 2010 at 6:08 PM, Jochem Maas <jochem(a)iamjochem.com> wrote: > > > Op 3/15/10 12:00 PM, David Hutto schreef: > > > On Mon, Mar 15, 2010 at 7:31 AM, Jochem Maas <jochem(a)iamjochem.com> > > wrote: > > > > > >> Op 3/15/10 8:24 AM, Midhun Girish schreef: > > >>> Hi , > > >>> Just as David Hutto has said,What you need is the cronjob... Make a > > >> script > > >>> say "check.php" which checks the db to see if any new entries are > > made... > > >>> and if yes send the mail ... > > >>> > > >>> now using the cronjob feature in linux os(which will be provided as a > > >>> service in your linux hosting cpanel), set a cronjob which calls the " > > >>> http://www.yoursite.com/check.php" URL every minute.... now a trigger > > >> will > > >>> be there every minute to the script and the emails will be send > > >> irrespective > > >>> of whether anyone is browsing the site or not.... hope it is clear... > > >>> > > >> > > >> use cron - yes > > >> have cron call a web URL - no, instead just call the script via the php > > CLI > > >> sapi, > > >> e.g. a cmdline as follows in cron: > > >> > > >> /usr/env php /path/to/your/check.php &> /dev/null > > >> > > > > > > > > > I do believe removing the /dev/null will send error messages during the > > > building of the script, correct? > > > > > > > the '&> /dev/null' redirects all output - I kind of make the assumption > > that the > > script would be logging stuff to a file or something when in production. > > > > so, yes, remove the redirection when your developing/testing the script. > > > > > > I agree. Even setting a cron on a local computer to call home to a server script would be preferable to Ajax calls. Thanks, Ash http://www.ashleysheridan.co.uk
From: Paul M Foster on 15 Mar 2010 14:12 On Mon, Mar 15, 2010 at 05:38:04PM -0000, Alex Major wrote: > Thanks to all for your help on this, it's been very interesting for me to > read. > > The system needs to check arrivals in real time (give or take a second or > two), using a cron job every minute doesn't provide the real time checking I > would like. > > However, when I then got to thinking about it, wouldn't this be an ideal > solution? I create a PHP script that loops for 60 seconds, checking the > database each second for new entries and processing them (meaning I get near > real time monitoring), and then have that PHP script called by a cron job > every minute. > > The reason I think that could be a good solution for me, is that if the PHP > script crashed (for any reason), then at most it's 59 seconds before the > system kicks in again and begins processing all the queued arrivals. If I > coded a PHP script to loop infinitely processing things every second, it's > possible I wouldn't notice a crash for a considerable amount of time. The > proposed solution provides a good fail-safe, I think. > > Does that solution seem sensible? Or overkill? > > Thanks again for your help in this, it's quite novel for me. I would think that the PHP CLI extension would need to be installed on the server for this to work. I don't know that that's common. (I could be completely wrong.) I would recommend coding this in C, because it would use far less resources. Paul -- Paul M. Foster
From: Gabriel Sosa on 15 Mar 2010 19:02 Indeed. This is kinda offtopic but if you put a cron running with a loop you will kill your server. I would recomend use libevent + ALARM signal to process on a time basis. On the other hand using C would be a nice aproach since you can put your script on an sleep mode until the next alarm signal is trigered + less resources taken Saludos On 3/15/10, Paul M Foster <paulf(a)quillandmouse.com> wrote: > On Mon, Mar 15, 2010 at 05:38:04PM -0000, Alex Major wrote: > >> Thanks to all for your help on this, it's been very interesting for me to >> read. >> >> The system needs to check arrivals in real time (give or take a second or >> two), using a cron job every minute doesn't provide the real time checking >> I >> would like. >> >> However, when I then got to thinking about it, wouldn't this be an ideal >> solution? I create a PHP script that loops for 60 seconds, checking the >> database each second for new entries and processing them (meaning I get >> near >> real time monitoring), and then have that PHP script called by a cron job >> every minute. >> >> The reason I think that could be a good solution for me, is that if the >> PHP >> script crashed (for any reason), then at most it's 59 seconds before the >> system kicks in again and begins processing all the queued arrivals. If I >> coded a PHP script to loop infinitely processing things every second, it's >> possible I wouldn't notice a crash for a considerable amount of time. The >> proposed solution provides a good fail-safe, I think. >> >> Does that solution seem sensible? Or overkill? >> >> Thanks again for your help in this, it's quite novel for me. > > I would think that the PHP CLI extension would need to be installed on > the server for this to work. I don't know that that's common. (I could > be completely wrong.) > > I would recommend coding this in C, because it would use far less > resources. > > Paul > > -- > Paul M. Foster > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Sent from my mobile device Gabriel Sosa Si buscas resultados distintos, no hagas siempre lo mismo. - Einstein
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Splitting a string ... Next: ldap_bind() connectivity |