On 05/23/2012 12:25 PM, Craig A. Adams wrote:
4. I have no idea what the 200 is. As a blind guess a locking period
in seconds or is it an access mode?
I believe that the 200 is a file descriptor number. File descriptors
are numbers that identify a certain file that is open for
reading/writing. For example, standard input is 0 and standard output is 1.
5. The "if [ $? != "0" ]" statement tests if there is already an
exclusive lock on the file and exits the entire script if there is.
More specifically, it tests if flock exited successfully (i.e. there is
a lock, in this case). It then exits the subshell (the section
surrounded by () parens).
7. The last line is part of the wrapper assumed in 1 above, actually
creating the lock file using the > redirector. But what is the 200 again?
The > redirector is redirecting file descriptor 200 to the file you are
specifying. In this case, I think that the choice of 200 is arbitrary.
As long as you redirect the same file descriptor that you pass to flock,
then the number shouldn't matter (though don't choose stdout :D)
--
rbmj
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4fbd183f.5090...@verizon.net