[clug-talk] file locking in bash?
carlsonmark at gmail.com
Fri Jul 27 08:04:19 PDT 2007
On 7/27/07, Roy Souther <roy at silicontao.com> wrote:
> Is there anyway to do file locking in a bash script? I need to remove the race hazard from a script that has multiple running instances per user, each trying to make changes to a text file. I need to get exclusive access to a file and make the other instances wait their turn.
> Any ideas? Flock is supported by more advances script engines like Perl but flock seems to be beyond the ability of a simple shell like bash.
flock(1) is not acceptable?
It uses the flock(2) sytem call, afaik.
More information about the clug-talk