mirror of
https://github.com/octoleo/restic.git
synced 2024-11-23 13:17:42 +00:00
doc: update init check with exit code 10
This commit is contained in:
parent
294c8524ed
commit
54ca27a6f2
@ -21,21 +21,22 @@ Check if a repository is already initialized
|
|||||||
********************************************
|
********************************************
|
||||||
|
|
||||||
You may find a need to 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
|
perhaps to prevent your script from trying to initialize a repository multiple
|
||||||
times. The command ``cat config`` may be used for this purpose:
|
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
|
.. code-block:: console
|
||||||
|
|
||||||
$ restic -r /srv/restic-repo cat config
|
$ 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?
|
Is there a repository at the following location?
|
||||||
/srv/restic-repo
|
/srv/restic-repo
|
||||||
|
|
||||||
If a repository does not exist, restic will return a non-zero exit code
|
If a repository does not exist, restic (since 0.17.0) will return exit code ``10``
|
||||||
and print an error message. Note that restic will also return a non-zero
|
and print a corresponding error message. Older versions return exit code ``1``.
|
||||||
exit code if a different error is encountered (e.g.: incorrect password
|
Note that restic will also return exit code ``1`` if a different error is encountered
|
||||||
to ``cat config``) and it may print a different error message. If there
|
(e.g.: incorrect password to ``cat config``) and it may print a different error message.
|
||||||
are no errors, restic will return a zero exit code and print the repository
|
If there are no errors, restic will return a zero exit code and print the repository
|
||||||
metadata.
|
metadata.
|
||||||
|
|
||||||
Exit codes
|
Exit codes
|
||||||
|
Loading…
Reference in New Issue
Block a user