logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

runlock.8 (3848B)


  1. .\" runlock.8
  2. .\" wcm, 2009.09.20 - 2009.12.14
  3. .\" ===
  4. .TH runlock 8 "January 2013" "runtools-2.07" "runtools"
  5. .SH NAME
  6. runlock \- run another program with a lockfile
  7. .SH SYNOPSIS
  8. .B runlock [\-bpx]
  9. .I lockfile program
  10. .B [
  11. .I args ...
  12. .B ]
  13. .br
  14. .B runlock \-c [\-q]
  15. .I lockfile
  16. .br
  17. .B runlock \-V | \-h
  18. .SH DESCRIPTION
  19. .B runlock
  20. may be used to run a program with a lockfile,
  21. or to check a lockfile for the presence of an existing lock.
  22. .PP
  23. In the first form of the command,
  24. .I lockfile
  25. is a filename and
  26. .I program
  27. is an executable program.
  28. .B runlock
  29. opens
  30. .I lockfile
  31. for writing (creating it if it does not exist),
  32. obtains an exclusive posix advisory lock on
  33. it (see
  34. .BR fcntl (2)),
  35. and then runs
  36. .IR program
  37. with any remaining arguments.
  38. .PP
  39. If the specified
  40. .I program
  41. name does not contain a ``/'' slash character,
  42. .B runlock
  43. will search for the executable in the search path
  44. defined in the environment by the
  45. .B PATH
  46. variable.
  47. .PP
  48. As long as
  49. .I program
  50. does not itself explicitly release the lock or close the descriptor for
  51. .IR lockfile ,
  52. the lock will remain until the
  53. .I program
  54. exits.
  55. Cooperative programs may test for the existence of a lock on
  56. .I lockfile
  57. to limit the execution of
  58. .I program
  59. to a single instance.
  60. .PP
  61. In the second form of the command (with the
  62. .B \-c
  63. option),
  64. .B runlock
  65. will check
  66. .I lockfile
  67. for an existing lock.
  68. If
  69. .I lockfile
  70. exists
  71. and can be opened for writing,
  72. .B runlock
  73. will report the pid of the process which holds a lock on the file.
  74. Note that the usefulness of this check is limited.
  75. A lock on
  76. .I lockfile
  77. may be acquired or released by another process at anytime.
  78. .SH OPTIONS
  79. .TP
  80. .B \-b
  81. Blocking.
  82. Normally
  83. .B runlock
  84. exits immediately without running
  85. .I program
  86. if an existing lock is found on
  87. .IR lockfile .
  88. When the
  89. .B \-b
  90. option is specified,
  91. .B runlock
  92. waits (blocks) to run
  93. .I program
  94. until it can acquire a lock on
  95. .IR lockfile .
  96. .TP
  97. .B \-c
  98. Check mode.
  99. If this option is specified,
  100. .B runlock
  101. checks
  102. .I lockfile
  103. for the existence of a lock.
  104. .B runlock
  105. exits 0 if no lock is found,
  106. exits 1 if an existing lock is held,
  107. or exits 111 if there is a problem with
  108. .IR lockfile .
  109. .TP
  110. .B \-h
  111. Help.
  112. Print a brief usage message to stderr and exit.
  113. .TP
  114. .B \-p
  115. Pid.
  116. Normally
  117. .B runlock
  118. creates a zero-length
  119. .IR lockfile .
  120. If the
  121. .B \-p
  122. option is specified,
  123. .B runlock
  124. writes a human-readable process ID number into the
  125. .IR lockfile .
  126. .TP
  127. .B \-q
  128. Quiet.
  129. In check mode,
  130. the
  131. .B \-q
  132. option suppresses the messages normally printed to stderr.
  133. .TP
  134. .B \-V
  135. Version.
  136. Print the version number to stderr and exit.
  137. .TP
  138. .B \-x
  139. Exit no-error.
  140. Normally
  141. .B runlock
  142. prints an error message to stderr and exits nonzero if
  143. .I lockfile
  144. cannot be opened (or created) or locked.
  145. If the
  146. .B \-x
  147. option is specified,
  148. .B runlock
  149. quietly exits zero on these errors.
  150. .SH EXIT STATUS
  151. .B runlock
  152. exits with one of the following values:
  153. .TP
  154. 0
  155. .I program
  156. was invoked and completed successfully.
  157. In this case,
  158. the exit code is returned by the
  159. .IR program ,
  160. rather than by
  161. .B runlock
  162. itself.
  163. .TP
  164. 100
  165. .B runlock
  166. failed because of a usage error,
  167. such as an invalid command\-line option or argument.
  168. In this case,
  169. .B runlock
  170. prints a brief error message and usage help to stderr on exit.
  171. .TP
  172. 111
  173. .B runlock
  174. failed to acquire a lock due to some system or resource error,
  175. or because a lock was already found on
  176. .I lockfile
  177. (when not using the
  178. .B \-b
  179. option).
  180. In this case,
  181. .B runlock
  182. prints a brief diagnostic message to stderr on exit.
  183. .TP
  184. 1\-127
  185. .I program
  186. was invoked and failed with its own non-zero exit status.
  187. .SH AUTHOR
  188. Wayne Marshall, http://b0llix.net/perp/
  189. .SH SEE ALSO
  190. .nh
  191. .BR runtools_intro (8),
  192. .BR runargs (8),
  193. .BR runargv0 (8),
  194. .BR runchoom (8),
  195. .BR rundetach (8),
  196. .BR rundeux (8),
  197. .BR runenv (8),
  198. .BR runfile (8),
  199. .BR runlimit (8),
  200. .BR runpause (8),
  201. .BR runsession (8),
  202. .BR runtool (8),
  203. .BR runtrap (8),
  204. .BR runuid (8)
  205. .\" EOF