Re: [PHP] Run script every 30 seconds

2006-10-31 Thread Ed Lazor
On Oct 31, 2006, at 2:48 AM, Ahmad Al-Twaijiry wrote: yes, I think you can call it ,semi-real-time monitoring because we want the script when it run it should read some records in database and update other records That's kind of vague. I'm not able to give better advice without more infor

Re: [PHP] Run script every 30 seconds

2006-10-31 Thread Ahmad Al-Twaijiry
yes, I think you can call it ,semi-real-time monitoring because we want the script when it run it should read some records in database and update other records On 10/31/06, Ed Lazor <[EMAIL PROTECTED]> wrote: On Oct 30, 2006, at 10:26 AM, Ahmad Al-Twaijiry wrote: > is it possible to link the

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Ed Lazor
On Oct 30, 2006, at 10:26 AM, Ahmad Al-Twaijiry wrote: is it possible to link the script to my php interface (the one that the users is using it) and if the php interface page will run the script (IN background) if it didn't run for the last 30 seconds ? I see this is very hard and almost impos

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Richard Lynch
On Mon, October 30, 2006 11:29 am, Ahmad Al-Twaijiry wrote: > I have a script that I want it to run every 30 seconds, the problem is > that cronjob can run every 1 minute only, do you have any solution ? Run a script that never quits with: http://php.net/usleep while (true){ //your script here

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread David Otton
On Mon, 30 Oct 2006 21:26:29 +0300, Ahmad Al-Twaijiry wrote: The "right" way to do this, as others have mentioned, is with a daemon. Having said that... >is it possible to link the script to my php interface (the one that >the users is using it) and if the php interface page will run the >script

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Mitch Miller
Or, you could run two scripts every minute ... one that starts immediately, and one that sleeps for 30s before starting. -- Mitch Dave Hamber wrote: You could run the script as a daemon. man daemon. The sloppy way of running the script every 30 seconds would be to use sleep(30), but that w

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread John Nichel
Ahmad Al-Twaijiry wrote: Hi everyone, I have a script that I want it to run every 30 seconds, the problem is that cronjob can run every 1 minute only, do you have any solution ? Use atd. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL P

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Dave Hamber
You could run the script as a daemon. man daemon. The sloppy way of running the script every 30 seconds would be to use sleep(30), but that would cause the script to run at 30 seconds + execution time. If you make a loop like this you could get around that: $t=time()+31; while(true){

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Dr. Suhas Pharkute
You can still use Cronjob with 1 min setting and in use 2 processes 1. Run script immediately 2. Sleep for 30 sec and then run the script you can use exec/shell_exec functions with output redirected to soem file so that It will run in background. That way you have one process running at 0 sec a

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Ahmad Al-Twaijiry
Thank you all but the problem is that I don't have root access to the server to create daemon :) so if I just run the script in background with 30 seconds sleep and someone reboot the server (or the script dies for any reason ) I will lose my process :) any other ideas ? is it possible to li

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Dave Hamber
Sorry, slight adjustment, make that $t=time()-31; in the first line so that the script runs immediately. > You could run the script as a daemon. man daemon. > > The sloppy way of running the script every 30 seconds would be to use sleep(30), but that would cause the script to run at 30 seconds

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread James Tu
I've never tried this myself, but how about having the cron job kick off a script which will run script A and script B Script A runs right away, and script B runs after a delay of 30 seconds ( usleep(30* 100) )? -James On Oct 30, 2006, at 12:29 PM, Ahmad Al-Twaijiry wrote: Hi everyone,

RE: [PHP] Run script every 30 seconds

2006-10-30 Thread zoticaicpassion
I'd create a PHP service that stays on the background :), ensuring that such service never goes off from time to time will be the job of the cron job, a little dirty, but works for me. HTH -Original Message- From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 31, 200

Re: [PHP] Run script every 30 seconds

2006-10-30 Thread Chris Boget
I have a script that I want it to run every 30 seconds, the problem is that cronjob can run every 1 minute only, do you have any solution ? Set the script up as a 2 iteration loop with sleep( 30 ) at the end of the first iteration. Or something like that... thnx, Chris -- PHP General Mail