with-lock.rst.inc 2.7 KB

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