Michael Fowler wrote: > On Mon, Sep 02, 2002 at 03:56:22PM +0530, Ramprasad A Padmanabhan wrote: > >>Hi All, >> I am writing an web application where multiple users may write into >>the same file concurrently. Also there is a probability that there may >>be an admin who has opened up the file in 'vi' and editing the file. >> >> I want to avoid this concurrent multiple opens. >>I tried a range on perl modules like IO::LockedFile, File::Flock; >>LockFile::Simple etc but all these do not enforce any lock and worst >>they lock a file even if it is already open in vi > > > As has been mentioned elsewhere on this thread, all of these modules provide > only advisory locking. This means that each process that wishes to modify > the file must first lock it with the same method. > > This will not cause a problem with your application, because you can add the > locked ability to it. It will, however, cause a problem with your admin > editing the file directly. One solution is to force the admin to run their > editor in a wrapper. For example, you can provide the admin with a simple > script, say "edit-db-file", that locks the file just as your web application > does, and then invokes his preferred editor (in $ENV{VISUAL} or > $ENV{EDITOR}). You'll have to educate your admin (assuming he or she needs > it) that this is the only method with which they are to edit the file, and > that they must make their edits quickly. The quickly part is so that the > web application, and by extension the user of that application, doesn't have > to wait forever to edit the file, or receive an error after the lock times > out. > > Really, though, why is the admin editing this file directly? Can you not > provide some sort of web interface for the admin as well? That way the > admin can't screw up with the lock, and errors in the file itself are less > likely. > > > Michael > -- > Administrator www.shoebox.net > Programmer, System Administrator www.gallanttech.com > --
Thanx All But I will still like to have kernel enforced mandatory locking on the file Can you tell me how to do it -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]