From e57ff29f22dd26f59c50bf0ae0d844459a445949 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 27 Sep 2022 17:09:19 +0200 Subject: [PATCH] BORG_LOCK_WAIT=n env var to set default for --lock-wait option, fixes #5279 --- docs/usage/general/environment.rst.inc | 3 +++ src/borg/archiver/_common.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/usage/general/environment.rst.inc b/docs/usage/general/environment.rst.inc index bdec4219f..46cd6bf25 100644 --- a/docs/usage/general/environment.rst.inc +++ b/docs/usage/general/environment.rst.inc @@ -43,6 +43,9 @@ General: So, if you have a all-zero MAC address or other reasons to better externally control the host id, just set this environment variable to a unique value. If all your FQDNs are unique, you can just use the FQDN. If not, use fqdn@uniqueid. + BORG_LOCK_WAIT + You can set the default value for the ``--lock-wait`` option with this, so + you do not need to give it as a commandline option. BORG_LOGGING_CONF When set, use the given filename as INI_-style logging configuration. A basic example conf can be found at ``docs/misc/logging.conf``. diff --git a/src/borg/archiver/_common.py b/src/borg/archiver/_common.py index c223c236f..7b504d46c 100644 --- a/src/borg/archiver/_common.py +++ b/src/borg/archiver/_common.py @@ -468,7 +468,7 @@ def define_common_options(add_common_option): metavar="SECONDS", dest="lock_wait", type=int, - default=1, + default=int(os.environ.get("BORG_LOCK_WAIT", 1)), help="wait at most SECONDS for acquiring a repository/cache lock (default: %(default)d).", ) add_common_option(