📄 flock.1
字号:
.TH FLOCK "1" "November 2004" "flock (util-linux)" "User Commands".SH NAMEflock \- acquire a file lock and then execute a command with the lock held.SH SYNOPSIS.BR flock[ \fB\-\-shared\fR | \fB\-\-timeout=\fR\fIseconds\fR ] lockfile command ...SH DESCRIPTION.\" Add any additional description here.PPAcquire a file lock using the flock(2) system call and then executethe given command with the lock held. Depending on the options given,the lock can be either exclusive or shared, and the behavior in theevent of lock contention can be specified as either waitingindefinitely for the lock to become available (the default), orfailing if the lock does not become available after a specific time,which can be specified as zero to make the command not wait at all..PP.TP\fB\-\-shared\fRAcquire a shared lock. Acquiring a shared lock doesnot stop others from acquiring a shared lock, but it will stop othersfrom acquiring an exclusive lock. Conversely, acquiring an exclusivelock (the default) stops both exclusive and shared attempts to acquirethe lock. Typically, a shared lock is used if a command is just goingto read the locked data, and an exclusive lock is used if the commandmight write to it..TP\fB\-\-timeout=n\fRAbort if the lock cannot be acquired before \fIn\fR seconds.For a completely non-blocking attempt to acquire a lock, specify\fB\-\-timeout=0\fR.The timer applies only to the attempt to acquire the lock. As soonas the lock is acquired, the timeout is cancelled. The command tobe run is not subject to the timeout..PP.SH "EXAMPLES (invoking some imaginary programs)".hl.PPflock /etc/passwd read-and-write-to-passwd.PPflock \-\-shared /etc/passwd just-read-something-from-passwd.PPflock \-\-timeout=0 /sys /usr/local/bin/update-hotplug /sys.SH AUTHORWritten by Adam J. Richter
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -