So why the need for both files though... The file dosen't have to be
empty to be used as a lock... Why not just create a pid file and check
that instead of having one file to just hold the pid and another file
just to lock -- I'm just trying to determine if there is a specific
reason or it just has developed that way. Also just to be clear -- the
application is responsable for creating the pid file right?

Thank you!


On 6/27/05, Michael Gale <[EMAIL PROTECTED]> wrote:
> Hello,
> 
>         If a process exits normally the PID file will be removed, you are
> making the kernel kill the process by using `kill -9`.
> 
> You should not be using kill -9 as a norm. You should shutdown the
> application according to the documentation provided with the app.
> 
> If there is no specify way then a standard `kill` command should do not
> the trick.
> 
> If PID files are left behind usually this is because the process was
> shutdown correctly. This is not a problem, most applications will just
> over write the PID file the next time they start up.
> 
> How ever some apps will complain and then you would be required to
> remove the PID file.
> 
> If you pay closer attention to the files in /var/run and
> /var/lock/subsys you will notice that all the files in /var/run/ are
> about 5k and contain a number, which is the PID.
> 
> The files located in /var/lock/subsys will be empty :) because there are
> there as place holders / locks so to speak. When an application is
> running it can us this directory as for file locking. For example If I
> ran passwd and it needed to lock the file until I was done (which it
> does not) then it would touch a file called passwd in /var/lock/subsys
> and if another user tried to run passwd it would not let me make changes
> because the lock file exist.
> 
> Michael
> 
> 
> 
> Stephen Cartwright wrote:
> > But why are the files in /var/lock/subsys on RH and (RH based distros)
> > created given that there is already pid files in /var/run/ which can
> > be used to tell whether or not daemon is already running. The lock
> > files in /var/lock/subsys don't seem to lock a resource, they just
> > seem to indicate that the process is running... but then why not just
> > use the pid file?
> >
> > Also what happens if the process dies unexpectedly? How does it work
> > with pid files? Is the creation and removal of the pid file done by
> > the OS? Is /var/run checked for old pid files? I used "kill -9" to
> > kill a process and the pid file was still there.
> >
> > Thank you!
> >
> > On 6/27/05, Robert Lewko <[EMAIL PROTECTED]> wrote:
> >
> >>On June 27, 2005 10:47 am, Stephen Cartwright wrote:
> >>
> >>>What exactly is the difference between a pid file and a subsystem lock
> >>>file? Why do you need both of them?
> >>>
> >>>Thanks!
> >>
> >>A *.pid file is a file that keeps the PID "process id" and that is to record
> >>which process to send signals to for various reasons, ie. killing the 
> >>process
> >>(thats not the only reason, but the most common one).
> >>
> >>What a lock file is for is to signal that a particular resource is in use
>

_______________________________________________
clug-talk mailing list
[email protected]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying

Reply via email to