User Tools

Site Tools


programming:c:lockf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

programming:c:lockf [2008/04/30 18:21] – created crustymonkeyprogramming:c:lockf [2008/04/30 18:22] (current) crustymonkey
Line 4: Line 4:
 ====== Why Use It? ====== ====== Why Use It? ======
 This is very helpful when running a cron job that might run long enough that it would "overlap" with the next cron run.  This will cause the overlapping instance to exit, alternatively after ''-t <seconds>'' timeout. This is very helpful when running a cron job that might run long enough that it would "overlap" with the next cron run.  This will cause the overlapping instance to exit, alternatively after ''-t <seconds>'' timeout.
- 
-====== Usage ====== 
-<code> 
-$ lockf --help 
-usage: lockf [-ks] [-t seconds] file command [arguments] 
-</code> 
-A typical call would be: 
-<code> 
-$ lockf -t 30 /tmp/mybinary.lock mybinary --arg=blah --arg2=blah2 
-</code> 
-This would create a lockfile, ''/tmp/mybinary.lock'', that would cause any more ''lockf'' calls with that file to fail.  The ''-t 30'' means that if lockf cannot obtain a lock after 30 seconds, it will exit. 
  
 ====== Download ====== ====== Download ======
Line 26: Line 15:
 # make && make install # make && make install
 </code> </code>
 +The above will install the binary in ''/usr/bin'' and the man page in ''/usr/share/man/man1'' If you want something different, just modify the paths in the ''Makefile''.
 +
 +====== Usage ======
 +<code>
 +$ lockf --help
 +usage: lockf [-ks] [-t seconds] file command [arguments]
 +</code>
 +A typical call would be:
 +<code>
 +$ lockf -t 30 /tmp/mybinary.lock mybinary --arg=blah --arg2=blah2
 +</code>
 +This would create a lockfile, ''/tmp/mybinary.lock'', that would cause any more ''lockf'' calls with that file to fail.  The ''-t 30'' means that if lockf cannot obtain a lock after 30 seconds, it will exit.
programming/c/lockf.1209579667.txt.gz · Last modified: 2008/04/30 18:21 by crustymonkey