Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!usc!sdsu!csun!csuna!abcscnge From: abcscnge@csuna.csun.edu (Scott "The Pseudo-Hacker" Neugroschl) Newsgroups: comp.unix.questions Subject: Re: mutual exclusion write access Message-ID: <2104@csuna.csun.edu> Date: 30 Jul 89 22:49:34 GMT References: <432@mccc.UUCP> <9700009@osiris.cso.uiuc.edu> <2277@auspex.auspex.com> <470@glyph.UUCP> <5275@ficc.uu.net> <1505@laura.UUCP> Reply-To: abcscnge@csuna.csun.edu (Scott Neugroschl) Organization: CSU Northridge Lines: 40 In article <1505@laura.UUCP> bause@exunido.UUCP (Falko Bause) writes: ] ]I want to allow only mutually exclusive write-accesses to a certain file. ]I've searched through the manual pages and have only found commands ]like lockf. But these commands only allow to establish a mutual ]exlusive access for sub-processes of some process. ] ]Let's explain, what I want, through an example: ] ]There is a file (e.g.) named text. I want that the following commands ]getting only exclusive write access: ] du > text ] ls -R > text ] myprog > text etc. ] This is kind of kludgy, but how about: ( chmod 600 text ; du ) > text This allows "text" to be writable only by you. If you don't want yourself to overwrite your own data: ( chmod 400 text ; du ) > text or, if you're REALLY paranoid: ( chmod 000 text ; du ) > text The shell creates "text" before executing the subshell commands, thus the file is ALREADY open, so there is no problem with changing the modes. Of course, the last is kind of useless, cuz you have to chmod text to some readable mode. -- Scott "The Pseudo-Hacker" Neugroschl UUCP: ...!sm.unisys.com!csun!csuna.csun.edu!abcscnge -- Beat me, Whip me, make me code in Ada -- Disclaimers? We don't need no stinking disclaimers!!!