Re: FLOCK
As much as I would like to use a database, like MySQL, I can't find an example of the code that isn't in a perl formay I can read and understand, I don't know alot about perl and its assumed vars like $_ and the super compressed codes using {[\f\t\t/t/y/g/d/d\.s1?]} .. yeah.. i jusy made that up but it looks like the perl code I see ... super secret coded perl so I use semephore files and flock...maybe it will help you. Lou Hernsen - Original Message - From: "Akbar Ehsan" <[EMAIL PROTECTED]> To: Sent: Tuesday, May 29, 2007 4:33 PM Subject: FLOCK > Hello Everyone, > > I am attempting to lock a file using FLOCK. I understand the FLOCK is an > advisory lock and that it does not prevent any other process/program > from "clobbering" the file even when the lock in on the file. > > Is there anything I should look into to apply a lock on a file so that > it does not get written to when the lock is in place? > > Any thoughts or ideas would be appreciated. > > Thanks. > > Akbar Ehsan > Internet Services Coordinator > Central Office > Ivy Tech Community College > 9301 E. 59th St. > Indianapolis, IN 46216 > Phone: 1 317 921-4872 > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.446 / Virus Database: 269.8.0/821 - Release Date: 5/27/07 3:05 PM > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: FLOCK
On 5/29/07, Akbar Ehsan <[EMAIL PROTECTED]> wrote: Hello Everyone, I am attempting to lock a file using FLOCK. I understand the FLOCK is an advisory lock and that it does not prevent any other process/program from "clobbering" the file even when the lock in on the file. Is there anything I should look into to apply a lock on a file so that it does not get written to when the lock is in place? Any thoughts or ideas would be appreciated. Thanks. Akbar, The short answer is "no." There really is no such thing as mandatory file locking, at least not from a program's point of view. If you have complete control over the execution environment, most operating systems support some kind of sticky bit which, combined with specific mount flags on a given volume, can enforce mandatory locks. But unless you are writing tour program to run on one specific machine that you and you alone administer, there is no silver bullet here. If concurrent writes are really something you're worried about, your best bets are, as others have suggested, to configure your program to use a database that enforces locks or supports row locking, or to use a client-server approach where all writes are dispatched to a single writer process that serializes the write requests before committing them to disk. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
Re: FLOCK
Akbar Ehsan wrote: Thanks for the response. Here is the situation. We have a web form that creates a tab-delimited text file. We want to lock this file to clean up the file, may be for a minute, so that if anyone submits a form request, it does not get written to the. I have been looking at and reading about FLOCK and feel it will not server the purpose. I am hoping to find out if someone knows about some other function/module to lock a file for a brief period of time. In this situation, I would tag each file with a unique identifier (a session ID, for example, like tabdelimited.hd76283420kdfsak9a.txt). Then, multiple submissions create different files. Then, you can have a cron job or other cleanup script go through and remove the old or complete files. Sean -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: FLOCK
Akbar Ehsan wrote: Hello Everyone, I am attempting to lock a file using FLOCK. I understand the FLOCK is an advisory lock and that it does not prevent any other process/program from "clobbering" the file even when the lock in on the file. Is there anything I should look into to apply a lock on a file so that it does not get written to when the lock is in place? Any thoughts or ideas would be appreciated. I'm not sure what you are trying to do, but you might want to look at using a transactional database like mysql or postgresql. Sean -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
FLOCK
Hello Everyone, I am attempting to lock a file using FLOCK. I understand the FLOCK is an advisory lock and that it does not prevent any other process/program from "clobbering" the file even when the lock in on the file. Is there anything I should look into to apply a lock on a file so that it does not get written to when the lock is in place? Any thoughts or ideas would be appreciated. Thanks. Akbar Ehsan Internet Services Coordinator Central Office Ivy Tech Community College 9301 E. 59th St. Indianapolis, IN 46216 Phone: 1 317 921-4872 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/