Add scripting section to docs

This commit is contained in:
Ali Razeen 2018-04-04 10:43:20 -04:00
parent 4478d633e2
commit 325957443e
2 changed files with 40 additions and 0 deletions

39
doc/075_scripting.rst Normal file
View file

@ -0,0 +1,39 @@
..
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 Pythons
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
times. The command ``snapshots`` may be used for this purpose:
.. code-block:: console
$ restic -r /tmp/backup snapshots
Fatal: unable to open config file: Stat: stat /tmp/backup/config: no such file or directory
Is there a repository at the following location?
/tmp/backup
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 ``snapshots``) and it may print a different error message. If there
are no errors, restic will return a zero exit code and print all the
snapshots.

View file

@ -12,6 +12,7 @@ Restic Documentation
050_restore
060_forget
070_encryption
075_scripting
080_examples
090_participating
100_references