flock.1 (699B)
1 .Dd 2015-10-08 2 .Dt FLOCK 1 3 .Os sbase 4 .Sh NAME 5 .Nm flock 6 .Nd tool to manage locks on files 7 .Sh SYNOPSIS 8 .Nm 9 .Op Fl nosux 10 .Ar file 11 .Ar cmd Op arg ... 12 .Sh DESCRIPTION 13 .Nm 14 is used to manage advisory locks on open files. It is commonly used to prevent 15 long running cron jobs from running in parallel. If 16 .Ar file 17 does not exist, it will be created. 18 .Sh OPTIONS 19 .Bl -tag -width Ds 20 .It Fl n 21 Set non-blocking mode on the lock. Fail immediately if the lock 22 cannot be acquired. 23 .It Fl o 24 Close the file descriptor before exec to avoid having the exec'ed 25 program holding on to the lock. 26 .It Fl s 27 Acquire a shared lock. 28 .It Fl u 29 Release the lock. 30 .It Fl x 31 Acquire an exclusive lock. This is the default. 32 .El