2018-04-04 14:43:20 +00:00
|
|
|
|
..
|
|
|
|
|
Normally, there are no heading levels assigned to certain characters as the structure is
|
|
|
|
|
determined from the succession of headings. However, this convention is used in Python’s
|
|
|
|
|
Style Guide for documenting which you may follow:
|
|
|
|
|
|
|
|
|
|
# with overline, for parts
|
|
|
|
|
* for chapters
|
|
|
|
|
= for sections
|
|
|
|
|
- for subsections
|
|
|
|
|
^ for subsubsections
|
|
|
|
|
" for paragraphs
|
|
|
|
|
|
|
|
|
|
#########################
|
|
|
|
|
Scripting
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
|
|
This is a list of how certain tasks may be accomplished when you use
|
|
|
|
|
restic via scripts.
|
|
|
|
|
|
|
|
|
|
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
|
2023-04-21 20:56:31 +00:00
|
|
|
|
times. The command ``cat config`` may be used for this purpose:
|
2018-04-04 14:43:20 +00:00
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
2023-04-21 20:56:31 +00:00
|
|
|
|
$ restic -r /srv/restic-repo cat config
|
|
|
|
|
Fatal: unable to open config file: stat /srv/restic-repo/config: no such file or directory
|
2018-04-04 14:43:20 +00:00
|
|
|
|
Is there a repository at the following location?
|
2018-04-28 14:19:16 +00:00
|
|
|
|
/srv/restic-repo
|
2018-04-04 14:43:20 +00:00
|
|
|
|
|
|
|
|
|
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
|
2023-04-21 20:56:31 +00:00
|
|
|
|
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.
|