From 54ca27a6f2345d4f2fc4e1b60319078bf7d02761 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 30 Jun 2024 19:13:00 +0200 Subject: [PATCH] doc: update init check with exit code 10 --- doc/075_scripting.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/075_scripting.rst b/doc/075_scripting.rst index ae876c9ea..87ae4fcf4 100644 --- a/doc/075_scripting.rst +++ b/doc/075_scripting.rst @@ -21,21 +21,22 @@ Check if a repository is already initialized ******************************************** You may find a need to check if a repository is already initialized, -perhaps to prevent your script from initializing a repository multiple -times. The command ``cat config`` may be used for this purpose: +perhaps to prevent your script from trying to initialize a repository multiple +times (the ``init`` command contains a check to prevent overwriting existing +repositories). The command ``cat config`` may be used for this purpose: .. code-block:: console $ restic -r /srv/restic-repo cat config - Fatal: unable to open config file: stat /srv/restic-repo/config: no such file or directory + Fatal: repository does not exist: unable to open config file: stat /srv/restic-repo/config: no such file or directory Is there a repository at the following location? /srv/restic-repo -If a repository does not exist, restic will return a non-zero exit code -and print an error message. Note that restic will also return a non-zero -exit code if a different error is encountered (e.g.: incorrect password -to ``cat config``) and it may print a different error message. If there -are no errors, restic will return a zero exit code and print the repository +If a repository does not exist, restic (since 0.17.0) will return exit code ``10`` +and print a corresponding error message. Older versions return exit code ``1``. +Note that restic will also return exit code ``1`` if a different error is encountered +(e.g.: incorrect password to ``cat config``) and it may print a different error message. +If there are no errors, restic will return a zero exit code and print the repository metadata. Exit codes