with-lock.rst.inc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
  2. .. _borg_with-lock:
  3. borg with-lock
  4. --------------
  5. .. code-block:: none
  6. borg [common options] with-lock [options] COMMAND [ARGS...]
  7. .. only:: html
  8. .. class:: borg-options-table
  9. +-------------------------------------------------------+-------------+-------------------+
  10. | **positional arguments** |
  11. +-------------------------------------------------------+-------------+-------------------+
  12. | | ``COMMAND`` | command to run |
  13. +-------------------------------------------------------+-------------+-------------------+
  14. | | ``ARGS`` | command arguments |
  15. +-------------------------------------------------------+-------------+-------------------+
  16. | .. class:: borg-common-opt-ref |
  17. | |
  18. | :ref:`common_options` |
  19. +-------------------------------------------------------+-------------+-------------------+
  20. .. raw:: html
  21. <script type='text/javascript'>
  22. $(document).ready(function () {
  23. $('.borg-options-table colgroup').remove();
  24. })
  25. </script>
  26. .. only:: latex
  27. COMMAND
  28. command to run
  29. ARGS
  30. command arguments
  31. :ref:`common_options`
  32. |
  33. Description
  34. ~~~~~~~~~~~
  35. This command runs a user-specified command while locking the repository. For example:
  36. ::
  37. $ BORG_REPO=/mnt/borgrepo borg with-lock rsync -av /mnt/borgrepo /somewhere/else/borgrepo
  38. It will first try to acquire the lock (make sure that no other operation is
  39. running in the repo), then execute the given command as a subprocess and wait
  40. for its termination, release the lock and return the user command's return
  41. code as borg's return code.
  42. .. note::
  43. If you copy a repository with the lock held, the lock will be present in
  44. the copy. Thus, before using borg on the copy from a different host,
  45. you need to use "borg break-lock" on the copied repository, because
  46. Borg is cautious and does not automatically remove stale locks made by a different host.