[NTLUG:Discuss] Flock file hanging around

Stuart Johnston saj at thecommune.net
Mon Jan 28 12:52:54 CST 2013


On 1/28/2013 12:46 PM, Neil Aggarwal wrote:
> Hello All:
>
> I wrote a shell script using flock:
>
> #!/bin/bash
> (
> flock -x 200
> # Perform tasks here...
> sleep 5
> ) 200>/var/lock/mylock
>
> After the script exits, the mylock file is still there.
> I thought flock is supposed to remove it after the script finishes.

No, flock doesn't assume that the file is being used exclusively as a 
lock file. You could be locking a data file, for example.





More information about the Discuss mailing list