[ale] file locking?
Wandered Inn
esoteric at denali.atlnet.com
Thu Aug 2 10:22:32 EDT 2001
John Wells wrote:
>
> Is there a way to lock files (ie, prevent writing to)
> from a shell?
Someone's always proving me wrong, but to my knowledge, no you can not
'atomically' lock a file from a script. You can attempt to protect it
by changing perms, but between creating it and then changing the perms,
there's a window where someone could write to it. You could do this
with Perl
Using a bit of creativity you might be able to do what you want to do,
but you'd have to explain the process a bit more. For example, if you
want folks to be able to read the file, but not write to it, you can set
your umask properly prior to creating the file. Or, you can create the
file in a tmp directory, chmod the file, then move it where you want
it. Again, though, without knowing more about what you're trying to do,
I'm not sure these approaches will work.
>
> Thanks
> John
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
> --
> To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
--
Until later: Geoffrey esoteric at denali.atlnet.com
"Great spirits have always found violent opposition from mediocre minds.
The latter cannot understand it when a man does not thoughtlessly submit
to hereditary prejudices but honestly and courageously uses his
intelligence." - Albert Einstein
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
More information about the Ale
mailing list