You are here: RE: [PHP] How to determine if a script instance is already runnin g? « PHP « IT news, forums, messages
RE: [PHP] How to determine if a script instance is already runnin g?

Posted by Jim Moseby on 08/02/05 18:28

> -----Original Message-----
> From: Matt [mailto:datahead4@gmail.com]
> Sent: Tuesday, August 02, 2005 10:45 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] How to determine if a script instance is already
> running?
>
>
> Perhaps "svscan" and its associated "daemontools" programs could be
> used to monitor the script instead of relying on cron.
>
> http://cr.yp.to/daemontools.html
>
> On 8/2/05, André Medeiros <andre.caum@gmail.com> wrote:
> > On Tue, 2005-08-02 at 15:09 +0100, Stut wrote:
> > > André Medeiros wrote:
> > > > Do like some services do:
> > > >
> > > > 1) Check if script.pid exists
> > > > 2) If it doesn't
> > > > 2.1) Write the process's PID onto the file
> > > > (http://pt.php.net/manual/en/function.getmypid.php)
> > > > 3) If it does
> > > > 3.1) Die gracefully :)
> > >
> > > Personally I'd extend that slightly to have the process
> touch the PID
> > > file every so often and to check that it's been touched
> recently when it
> > > starts up. Alternatively use the ps shell command to check that a
> > > process with that PID is still running, but that tends to
> be less reliable.
> > >
> > > If the process does decide to continue in spite of the
> PID file existing
> > > it should issue a a shell kill command to kill that PID
> in case it's
> > > hung or a zombie.
> > >
> > > -Stut
> >
> > Excelent point!

Thanks to all who replied. I'll let the list know how it works out.

JM

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация