[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Deleting a file/directory on startup



Till Maas wrote:
On Mon January 14 2008, Casey Dahlin wrote:

The most correct way is to put some content in the lockfile to allow it
to be determined if it is valid. Then pm-utils itself can figure it out
when its run.

How can this be done in a bullet-proof way[1]? Also it seems to be a lot more complicated than just to make sure, that the lockdirectory is removed on startup (and there are already a lot of files and directories that are removed on startup by rc.sysinit, so it is more a common way to do it). The best way I know would be to be able to identify whether or not a system was rebooted since a file was created, but given there are systems that do not have a hardware clock, I do not know of a way to identify it. Is there, e.g. a file in /proc or /sys that will have a unique content that only changes every time a system is powered up?

Last week I answered and said a standard technique is the use of pid files and explained how it works. Is there some reason that approach does not give you exactly what you've asked for? The pid can either be in a separate pid file or in the lockfile, or both, just be aware of potential race conditions if the pid is in more than one file and do the operations in the correct order.

--
John Dennis <jdennis redhat com>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]