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,
|
2024-06-30 17:13:00 +00:00
|
|
|
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:
|
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
|
2024-06-30 17:13:00 +00:00
|
|
|
Fatal: repository does not exist: 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
|
|
|
|
2024-06-30 17:13:00 +00:00
|
|
|
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
|
2023-04-21 20:56:31 +00:00
|
|
|
metadata.
|
2020-05-16 04:40:09 +00:00
|
|
|
|
2024-08-25 21:52:33 +00:00
|
|
|
.. _exit-codes:
|
|
|
|
|
2024-07-10 19:47:03 +00:00
|
|
|
Exit codes
|
|
|
|
**********
|
|
|
|
|
|
|
|
Restic commands return an exit code that signals whether the command was successful.
|
|
|
|
The following table provides a general description, see the help of each command for
|
|
|
|
a more specific description.
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
New exit codes will be added over time. If an unknown exit code is returned, then it
|
|
|
|
MUST be treated as a command failure.
|
|
|
|
|
|
|
|
+-----+----------------------------------------------------+
|
|
|
|
| 0 | Command was successful |
|
|
|
|
+-----+----------------------------------------------------+
|
|
|
|
| 1 | Command failed, see command help for more details |
|
|
|
|
+-----+----------------------------------------------------+
|
|
|
|
| 2 | Go runtime error |
|
|
|
|
+-----+----------------------------------------------------+
|
|
|
|
| 3 | ``backup`` command could not read some source data |
|
|
|
|
+-----+----------------------------------------------------+
|
|
|
|
| 10 | Repository does not exist (since restic 0.17.0) |
|
|
|
|
+-----+----------------------------------------------------+
|
|
|
|
| 11 | Failed to lock repository (since restic 0.17.0) |
|
|
|
|
+-----+----------------------------------------------------+
|
2024-07-30 23:06:18 +00:00
|
|
|
| 12 | Wrong password (since restic 0.17.1) |
|
|
|
|
+-----+----------------------------------------------------+
|
2024-07-10 19:47:03 +00:00
|
|
|
| 130 | Restic was interrupted using SIGINT or SIGSTOP |
|
|
|
|
+-----+----------------------------------------------------+
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
JSON output
|
|
|
|
***********
|
2020-05-16 04:40:09 +00:00
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
Restic outputs JSON data to ``stdout`` if requested with the ``--json`` flag.
|
2020-05-16 04:40:09 +00:00
|
|
|
The structure of that data varies depending on the circumstance. The
|
2023-06-08 22:46:55 +00:00
|
|
|
JSON output of most restic commands are documented here.
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
.. note::
|
2023-06-08 22:46:55 +00:00
|
|
|
Not all commands support JSON output. If a command does not support JSON output,
|
2020-11-26 07:54:53 +00:00
|
|
|
feel free to submit a pull request!
|
2020-05-16 04:40:09 +00:00
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
.. warning::
|
|
|
|
We try to keep the JSON output backwards compatible. However, new message types
|
|
|
|
or fields may be added at any time. Similarly, enum-like fields for which a fixed
|
|
|
|
list of allowed values is documented may be extended at any time.
|
|
|
|
|
|
|
|
|
2024-08-03 20:20:56 +00:00
|
|
|
Exit errors
|
|
|
|
-----------
|
|
|
|
|
|
|
|
Fatal errors will result in a final JSON message on ``stderr`` before the process exits.
|
|
|
|
It will hold the error message and the exit code.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
Some errors cannot be caught and reported this way,
|
|
|
|
such as Go runtime errors or command line parsing errors.
|
|
|
|
|
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``message_type`` | Always "exit_error" |
|
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``code`` | Exit code (see above chart) |
|
|
|
|
+----------------------+-------------------------------------------+
|
2024-08-17 19:00:39 +00:00
|
|
|
| ``message`` | Error message |
|
2024-08-03 20:20:56 +00:00
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
Output formats
|
|
|
|
--------------
|
|
|
|
|
2024-08-03 20:20:56 +00:00
|
|
|
Commands print their main JSON output on ``stdout``.
|
|
|
|
The generated JSON output uses one of the following two formats.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
Not all messages and errors have been converted to JSON yet.
|
|
|
|
Feel free to submit a pull request!
|
2023-06-08 22:46:55 +00:00
|
|
|
|
|
|
|
Single JSON document
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Several commands output a single JSON document that can be parsed in its entirety.
|
|
|
|
Depending on the command, the output consists of either a single or multiple lines.
|
|
|
|
|
|
|
|
JSON lines
|
|
|
|
^^^^^^^^^^
|
2020-05-16 04:40:09 +00:00
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
Several commands, in particular long running ones or those that generate a large output,
|
|
|
|
use a format also known as JSON lines. It consists of a stream of new-line separated JSON
|
|
|
|
messages. You can determine the nature of the message using the ``message_type`` field.
|
2020-11-26 07:54:53 +00:00
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
backup
|
|
|
|
------
|
|
|
|
|
|
|
|
The ``backup`` command uses the JSON lines format with the following message types.
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
Status
|
|
|
|
^^^^^^
|
|
|
|
|
2020-11-26 07:54:53 +00:00
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``message_type`` | Always "status" |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``seconds_elapsed`` | Time since backup started |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``seconds_remaining`` | Estimated time remaining |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``percent_done`` | Percentage of data backed up (bytes_done/total_bytes) |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``total_files`` | Total number of files detected |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
|``files_done`` | Files completed (backed up to repo) |
|
2020-11-26 07:54:53 +00:00
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``total_bytes`` | Total number of bytes in backup set |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
|``bytes_done`` | Number of bytes completed (backed up to repo) |
|
2020-11-26 07:54:53 +00:00
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``error_count`` | Number of errors |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``current_files`` | List of files currently being backed up |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
Error
|
|
|
|
^^^^^
|
|
|
|
|
2024-08-03 20:20:56 +00:00
|
|
|
These errors are printed on ``stderr``.
|
|
|
|
|
2020-11-26 07:54:53 +00:00
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``message_type`` | Always "error" |
|
|
|
|
+----------------------+-------------------------------------------+
|
2024-08-03 19:29:10 +00:00
|
|
|
| ``error.message`` | Error message |
|
2020-11-26 07:54:53 +00:00
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``during`` | What restic was trying to do |
|
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``item`` | Usually, the path of the problematic file |
|
|
|
|
+----------------------+-------------------------------------------+
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
Verbose Status
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
Verbose status provides details about the progress, including details about backed up files.
|
|
|
|
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``message_type`` | Always "verbose_status" |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``action`` | Either "new", "unchanged", "modified" or "scan_finished" |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``item`` | The item in question |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``duration`` | How long it took, in seconds |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``data_size`` | How big the item is |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``metadata_size`` | How big the metadata is |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``total_files`` | Total number of files |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
Summary
|
|
|
|
^^^^^^^
|
|
|
|
|
2023-08-27 08:46:21 +00:00
|
|
|
Summary is the last output line in a successful backup.
|
2020-11-26 07:54:53 +00:00
|
|
|
|
2020-05-16 04:40:09 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``message_type`` | Always "summary" |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``files_new`` | Number of new files |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``files_changed`` | Number of files that changed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``files_unmodified`` | Number of files that did not change |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``dirs_new`` | Number of new directories |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``dirs_changed`` | Number of directories that changed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``dirs_unmodified`` | Number of directories that did not change |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-10-27 18:22:34 +00:00
|
|
|
| ``data_blobs`` | Number of data blobs added |
|
2020-05-16 04:40:09 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-10-27 18:22:34 +00:00
|
|
|
| ``tree_blobs`` | Number of tree blobs added |
|
2020-05-16 04:40:09 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-02-22 21:17:54 +00:00
|
|
|
| ``data_added`` | Amount of (uncompressed) data added, in bytes |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-02-25 19:40:52 +00:00
|
|
|
| ``data_added_packed`` | Amount of data added (after compression), in bytes |
|
2020-05-16 04:40:09 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``total_files_processed`` | Total number of files processed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``total_bytes_processed`` | Total number of bytes processed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-11-01 14:50:09 +00:00
|
|
|
| ``backup_start`` | Time at which the backup was started |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``backup_end`` | Time at which the backup was completed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
2020-05-16 04:40:09 +00:00
|
|
|
| ``total_duration`` | Total time it took for the operation to complete |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-05-22 14:38:00 +00:00
|
|
|
| ``snapshot_id`` | ID of the new snapshot. Field is omitted if snapshot |
|
|
|
|
| | creation was skipped |
|
2020-05-16 04:40:09 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
cat
|
|
|
|
---
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
The ``cat`` command returns data about various objects in the repository, which
|
|
|
|
are stored in JSON form. Specifying ``--json`` or ``--quiet`` will suppress any
|
|
|
|
non-JSON messages the command generates.
|
|
|
|
|
|
|
|
|
|
|
|
diff
|
|
|
|
----
|
|
|
|
|
|
|
|
The ``diff`` command uses the JSON lines format with the following message types.
|
|
|
|
|
|
|
|
change
|
|
|
|
^^^^^^
|
|
|
|
|
|
|
|
+------------------+--------------------------------------------------------------+
|
|
|
|
| ``message_type`` | Always "change" |
|
|
|
|
+------------------+--------------------------------------------------------------+
|
|
|
|
| ``path`` | Path that has changed |
|
|
|
|
+------------------+--------------------------------------------------------------+
|
|
|
|
| ``modifier`` | Type of change, a concatenation of the following characters: |
|
|
|
|
| | "+" = added, "-" = removed, "T" = entry type changed, |
|
2023-10-20 18:15:53 +00:00
|
|
|
| | "M" = file content changed, "U" = metadata changed, |
|
|
|
|
| | "?" = bitrot detected |
|
2023-06-08 22:46:55 +00:00
|
|
|
+------------------+--------------------------------------------------------------+
|
|
|
|
|
|
|
|
statistics
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
+---------------------+----------------------------+
|
|
|
|
| ``message_type`` | Always "statistics" |
|
|
|
|
+---------------------+----------------------------+
|
|
|
|
| ``source_snapshot`` | ID of first snapshot |
|
|
|
|
+---------------------+----------------------------+
|
|
|
|
| ``target_snapshot`` | ID of second snapshot |
|
|
|
|
+---------------------+----------------------------+
|
|
|
|
| ``changed_files`` | Number of changed files |
|
|
|
|
+---------------------+----------------------------+
|
|
|
|
| ``added`` | DiffStat object, see below |
|
|
|
|
+---------------------+----------------------------+
|
|
|
|
| ``removed`` | DiffStat object, see below |
|
|
|
|
+---------------------+----------------------------+
|
|
|
|
|
|
|
|
DiffStat object
|
|
|
|
|
|
|
|
+----------------+-------------------------------------------+
|
|
|
|
| ``files`` | Number of changed files |
|
|
|
|
+----------------+-------------------------------------------+
|
|
|
|
| ``dirs`` | Number of changed directories |
|
|
|
|
+----------------+-------------------------------------------+
|
|
|
|
| ``others`` | Number of changed other directory entries |
|
|
|
|
+----------------+-------------------------------------------+
|
|
|
|
| ``data_blobs`` | Number of data blobs |
|
|
|
|
+----------------+-------------------------------------------+
|
|
|
|
| ``tree_blobs`` | Number of tree blobs |
|
|
|
|
+----------------+-------------------------------------------+
|
|
|
|
| ``bytes`` | Number of bytes |
|
|
|
|
+----------------+-------------------------------------------+
|
|
|
|
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
find
|
|
|
|
----
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
The ``find`` command outputs a single JSON document containing an array of JSON
|
|
|
|
objects with matches for your search term. These matches are organized by snapshot.
|
|
|
|
|
|
|
|
If the ``--blob`` or ``--tree`` option is passed, then the output is an array of
|
|
|
|
Blob objects.
|
2020-05-16 04:40:09 +00:00
|
|
|
|
2020-11-26 07:54:53 +00:00
|
|
|
|
|
|
|
+-----------------+----------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
| ``hits`` | Number of matches in the snapshot |
|
2020-11-26 07:54:53 +00:00
|
|
|
+-----------------+----------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
| ``snapshot`` | ID of the snapshot |
|
2020-11-26 07:54:53 +00:00
|
|
|
+-----------------+----------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
| ``matches`` | Array of Match objects detailing a match |
|
2020-11-26 07:54:53 +00:00
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
Match object
|
2020-11-26 07:54:53 +00:00
|
|
|
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``path`` | Object path |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``permissions`` | UNIX permissions |
|
|
|
|
+-----------------+----------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
| ``type`` | Object type e.g. file, dir, etc... |
|
2020-11-26 07:54:53 +00:00
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``atime`` | Access time |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``mtime`` | Modification time |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``ctime`` | Change time |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``name`` | Object name |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``user`` | Name of owner |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``group`` | Name of group |
|
|
|
|
+-----------------+----------------------------------------------+
|
2023-10-11 18:35:43 +00:00
|
|
|
| ``inode`` | Inode number |
|
|
|
|
+-----------------+----------------------------------------------+
|
2020-11-26 07:54:53 +00:00
|
|
|
| ``mode`` | UNIX file mode, shorthand of ``permissions`` |
|
|
|
|
+-----------------+----------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
| ``device_id`` | OS specific device identifier |
|
2020-11-26 08:21:08 +00:00
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``links`` | Number of hardlinks |
|
|
|
|
+-----------------+----------------------------------------------+
|
2020-11-26 07:54:53 +00:00
|
|
|
| ``uid`` | ID of owner |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``gid`` | ID of group |
|
|
|
|
+-----------------+----------------------------------------------+
|
|
|
|
| ``size`` | Size of object in bytes |
|
|
|
|
+-----------------+----------------------------------------------+
|
2020-05-16 04:40:09 +00:00
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
Blob object
|
|
|
|
|
|
|
|
+-----------------+--------------------------------------------+
|
|
|
|
| ``object_type`` | Either "blob" or "tree" |
|
|
|
|
+-----------------+--------------------------------------------+
|
|
|
|
| ``id`` | ID of found blob |
|
|
|
|
+-----------------+--------------------------------------------+
|
|
|
|
| ``path`` | Path in snapshot |
|
|
|
|
+-----------------+--------------------------------------------+
|
|
|
|
| ``parent_tree`` | Parent tree blob, only set for type "blob" |
|
|
|
|
+-----------------+--------------------------------------------+
|
|
|
|
| ``snapshot`` | Snapshot ID |
|
|
|
|
+-----------------+--------------------------------------------+
|
|
|
|
| ``time`` | Snapshot timestamp |
|
|
|
|
+-----------------+--------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
forget
|
|
|
|
------
|
|
|
|
|
|
|
|
The ``forget`` command prints a single JSON document containing an array of
|
|
|
|
ForgetGroups. If specific snapshot IDs are specified, then no output is generated.
|
|
|
|
|
|
|
|
The ``prune`` command does not yet support JSON such that ``forget --prune``
|
|
|
|
results in a mix of JSON and text output.
|
|
|
|
|
|
|
|
ForgetGroup
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
+-------------+-----------------------------------------------------------+
|
|
|
|
| ``tags`` | Tags identifying the snapshot group |
|
|
|
|
+-------------+-----------------------------------------------------------+
|
|
|
|
| ``host`` | Host identifying the snapshot group |
|
|
|
|
+-------------+-----------------------------------------------------------+
|
|
|
|
| ``paths`` | Paths identifying the snapshot group |
|
|
|
|
+-------------+-----------------------------------------------------------+
|
|
|
|
| ``keep`` | Array of Snapshot objects that are kept |
|
|
|
|
+-------------+-----------------------------------------------------------+
|
|
|
|
| ``remove`` | Array of Snapshot objects that were removed |
|
|
|
|
+-------------+-----------------------------------------------------------+
|
|
|
|
| ``reasons`` | Array of Reason objects describing why a snapshot is kept |
|
|
|
|
+-------------+-----------------------------------------------------------+
|
|
|
|
|
|
|
|
Snapshot object
|
|
|
|
|
2023-07-08 21:29:46 +00:00
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``time`` | Timestamp of when the backup was started |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``parent`` | ID of the parent snapshot |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``tree`` | ID of the root tree blob |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``paths`` | List of paths included in the backup |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``hostname`` | Hostname of the backed up machine |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``username`` | Username the backup command was run as |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``uid`` | ID of owner |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``gid`` | ID of group |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``excludes`` | List of paths and globs excluded from the backup |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``tags`` | List of tags for the snapshot in question |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``program_version`` | restic version used to create snapshot |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``id`` | Snapshot ID |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``short_id`` | Snapshot ID, short form |
|
|
|
|
+---------------------+--------------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
|
|
|
|
Reason object
|
|
|
|
|
2024-03-25 14:42:15 +00:00
|
|
|
+----------------+-----------------------------------------------------------+
|
|
|
|
| ``snapshot`` | Snapshot object, including ``id`` and ``short_id`` fields |
|
|
|
|
+----------------+-----------------------------------------------------------+
|
|
|
|
| ``matches`` | Array containing descriptions of the matching criteria |
|
|
|
|
+----------------+-----------------------------------------------------------+
|
|
|
|
| ``counters`` | Object containing counters used by the policies |
|
|
|
|
+----------------+-----------------------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
init
|
|
|
|
----
|
|
|
|
|
|
|
|
The ``init`` command uses the JSON lines format, but only outputs a single message.
|
|
|
|
|
|
|
|
+------------------+--------------------------------+
|
|
|
|
| ``message_type`` | Always "initialized" |
|
|
|
|
+------------------+--------------------------------+
|
|
|
|
| ``id`` | ID of the created repository |
|
|
|
|
+------------------+--------------------------------+
|
|
|
|
| ``repository`` | URL of the repository |
|
|
|
|
+------------------+--------------------------------+
|
|
|
|
|
|
|
|
|
2020-05-16 04:40:09 +00:00
|
|
|
key list
|
|
|
|
--------
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
The ``key list`` command returns an array of objects with the following structure.
|
2020-11-26 07:54:53 +00:00
|
|
|
|
2020-05-16 04:40:09 +00:00
|
|
|
+--------------+------------------------------------+
|
|
|
|
| ``current`` | Is currently used key? |
|
|
|
|
+--------------+------------------------------------+
|
|
|
|
| ``id`` | Unique key ID |
|
|
|
|
+--------------+------------------------------------+
|
2020-11-26 07:54:53 +00:00
|
|
|
| ``userName`` | User who created it |
|
2020-05-16 04:40:09 +00:00
|
|
|
+--------------+------------------------------------+
|
2020-11-26 07:54:53 +00:00
|
|
|
| ``hostName`` | Name of machine it was created on |
|
2020-05-16 04:40:09 +00:00
|
|
|
+--------------+------------------------------------+
|
2020-11-26 07:54:53 +00:00
|
|
|
| ``created`` | Timestamp when it was created |
|
2020-05-16 04:40:09 +00:00
|
|
|
+--------------+------------------------------------+
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
|
2024-01-21 16:09:54 +00:00
|
|
|
.. _ls json:
|
|
|
|
|
2020-05-16 04:40:09 +00:00
|
|
|
ls
|
|
|
|
--
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
The ``ls`` command uses the JSON lines format with the following message types.
|
|
|
|
As an exception, the ``struct_type`` field is used to determine the message type.
|
2020-11-26 07:54:53 +00:00
|
|
|
|
2020-05-16 04:40:09 +00:00
|
|
|
snapshot
|
|
|
|
^^^^^^^^
|
|
|
|
|
2024-01-27 14:48:24 +00:00
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``message_type`` | Always "snapshot" |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``struct_type`` | Always "snapshot" (deprecated) |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``time`` | Timestamp of when the backup was started |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``parent`` | ID of the parent snapshot |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``tree`` | ID of the root tree blob |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``paths`` | List of paths included in the backup |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``hostname`` | Hostname of the backed up machine |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``username`` | Username the backup command was run as |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``uid`` | ID of owner |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``gid`` | ID of group |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``excludes`` | List of paths and globs excluded from the backup |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``tags`` | List of tags for the snapshot in question |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``id`` | Snapshot ID |
|
|
|
|
+------------------+--------------------------------------------------+
|
|
|
|
| ``short_id`` | Snapshot ID, short form |
|
|
|
|
+------------------+--------------------------------------------------+
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
node
|
|
|
|
^^^^
|
|
|
|
|
2024-01-27 14:48:24 +00:00
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``message_type`` | Always "node" |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``struct_type`` | Always "node" (deprecated) |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``name`` | Node name |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``type`` | Node type |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``path`` | Node path |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``uid`` | UID of node |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``gid`` | GID of node |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``size`` | Size in bytes |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``mode`` | Node mode |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``atime`` | Node access time |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``mtime`` | Node modification time |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``ctime`` | Node creation time |
|
|
|
|
+------------------+----------------------------+
|
|
|
|
| ``inode`` | Inode number of node |
|
|
|
|
+------------------+----------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
|
|
|
|
|
2023-06-17 19:47:17 +00:00
|
|
|
restore
|
|
|
|
-------
|
|
|
|
|
|
|
|
The ``restore`` command uses the JSON lines format with the following message types.
|
|
|
|
|
|
|
|
Status
|
|
|
|
^^^^^^
|
|
|
|
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``message_type`` | Always "status" |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``seconds_elapsed`` | Time since restore started |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2023-08-27 08:45:56 +00:00
|
|
|
|``percent_done`` | Percentage of data restored (bytes_restored/total_bytes) |
|
2023-06-17 19:47:17 +00:00
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``total_files`` | Total number of files detected |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``files_restored`` | Files restored |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2024-05-31 14:11:18 +00:00
|
|
|
|``files_skipped`` | Files skipped due to overwrite setting |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2024-12-01 14:29:11 +00:00
|
|
|
|``files_deleted`` | Files deleted |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2023-06-17 19:47:17 +00:00
|
|
|
|``total_bytes`` | Total number of bytes in restore set |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``bytes_restored`` | Number of bytes restored |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2024-05-31 14:11:18 +00:00
|
|
|
|``bytes_skipped`` | Total size of skipped files |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2023-06-17 19:47:17 +00:00
|
|
|
|
2024-08-03 19:29:10 +00:00
|
|
|
Error
|
|
|
|
^^^^^
|
|
|
|
|
2024-08-03 20:20:56 +00:00
|
|
|
These errors are printed on ``stderr``.
|
|
|
|
|
2024-08-03 19:29:10 +00:00
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``message_type`` | Always "error" |
|
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``error.message`` | Error message |
|
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``during`` | Always "restore" |
|
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
| ``item`` | Usually, the path of the problematic file |
|
|
|
|
+----------------------+-------------------------------------------+
|
|
|
|
|
2024-05-31 19:12:13 +00:00
|
|
|
Verbose Status
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Verbose status provides details about the progress, including details about restored files.
|
|
|
|
Only printed if `--verbose=2` is specified.
|
|
|
|
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``message_type`` | Always "verbose_status" |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
2024-06-29 19:29:42 +00:00
|
|
|
| ``action`` | Either "restored", "updated", "unchanged" or "deleted" |
|
2024-05-31 19:12:13 +00:00
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``item`` | The item in question |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
| ``size`` | Size of the item in bytes |
|
|
|
|
+----------------------+-----------------------------------------------------------+
|
|
|
|
|
2023-06-17 19:47:17 +00:00
|
|
|
Summary
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``message_type`` | Always "summary" |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``seconds_elapsed`` | Time since restore started |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``total_files`` | Total number of files detected |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``files_restored`` | Files restored |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2024-05-31 14:11:18 +00:00
|
|
|
|``files_skipped`` | Files skipped due to overwrite setting |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2024-12-01 14:29:11 +00:00
|
|
|
|``files_deleted`` | Files deleted |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2023-06-17 19:47:17 +00:00
|
|
|
|``total_bytes`` | Total number of bytes in restore set |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
|
|
|
|``bytes_restored`` | Number of bytes restored |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2024-05-31 14:11:18 +00:00
|
|
|
|``bytes_skipped`` | Total size of skipped files |
|
|
|
|
+----------------------+------------------------------------------------------------+
|
2023-06-17 19:47:17 +00:00
|
|
|
|
|
|
|
|
2023-06-08 22:46:55 +00:00
|
|
|
snapshots
|
|
|
|
---------
|
|
|
|
|
|
|
|
The snapshots command returns a single JSON object, an array with objects of the structure outlined below.
|
|
|
|
|
2023-07-08 21:29:46 +00:00
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``time`` | Timestamp of when the backup was started |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``parent`` | ID of the parent snapshot |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``tree`` | ID of the root tree blob |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``paths`` | List of paths included in the backup |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``hostname`` | Hostname of the backed up machine |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``username`` | Username the backup command was run as |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``uid`` | ID of owner |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``gid`` | ID of group |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``excludes`` | List of paths and globs excluded from the backup |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``tags`` | List of tags for the snapshot in question |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``program_version`` | restic version used to create snapshot |
|
|
|
|
+---------------------+--------------------------------------------------+
|
2024-02-23 21:29:10 +00:00
|
|
|
| ``summary`` | Snapshot statistics, see "Summary object" |
|
|
|
|
+---------------------+--------------------------------------------------+
|
2023-07-08 21:29:46 +00:00
|
|
|
| ``id`` | Snapshot ID |
|
|
|
|
+---------------------+--------------------------------------------------+
|
|
|
|
| ``short_id`` | Snapshot ID, short form |
|
|
|
|
+---------------------+--------------------------------------------------+
|
2023-06-08 22:46:55 +00:00
|
|
|
|
2024-02-23 21:29:10 +00:00
|
|
|
Summary object
|
|
|
|
|
|
|
|
The contained statistics reflect the information at the point in time when the snapshot
|
|
|
|
was created.
|
|
|
|
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``backup_start`` | Time at which the backup was started |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``backup_end`` | Time at which the backup was completed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``files_new`` | Number of new files |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``files_changed`` | Number of files that changed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``files_unmodified`` | Number of files that did not change |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``dirs_new`` | Number of new directories |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``dirs_changed`` | Number of directories that changed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``dirs_unmodified`` | Number of directories that did not change |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-10-27 18:22:34 +00:00
|
|
|
| ``data_blobs`` | Number of data blobs added |
|
2024-02-23 21:29:10 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-10-27 18:22:34 +00:00
|
|
|
| ``tree_blobs`` | Number of tree blobs added |
|
2024-02-23 21:29:10 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``data_added`` | Amount of (uncompressed) data added, in bytes |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
2024-02-25 19:40:52 +00:00
|
|
|
| ``data_added_packed`` | Amount of data added (after compression), in bytes |
|
2024-02-23 21:29:10 +00:00
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``total_files_processed`` | Total number of files processed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
| ``total_bytes_processed`` | Total number of bytes processed |
|
|
|
|
+---------------------------+---------------------------------------------------------+
|
|
|
|
|
2020-05-16 04:40:09 +00:00
|
|
|
|
|
|
|
stats
|
|
|
|
-----
|
|
|
|
|
2023-12-18 22:04:46 +00:00
|
|
|
The stats command returns a single JSON object.
|
2023-06-08 22:46:55 +00:00
|
|
|
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``total_size`` | Repository size in bytes |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``total_file_count`` | Number of files backed up in the repository |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``total_blob_count`` | Number of blobs in the repository |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``snapshots_count`` | Number of processed snapshots |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``total_uncompressed_size`` | Repository size in bytes if blobs were uncompressed |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``compression_ratio`` | Factor by which the already compressed data |
|
|
|
|
| | has shrunk due to compression |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``compression_progress`` | Percentage of already compressed data |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
|
|
|
| ``compression_space_saving`` | Overall space saving due to compression |
|
|
|
|
+------------------------------+-----------------------------------------------------+
|
2023-11-01 21:13:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
version
|
|
|
|
-------
|
|
|
|
|
|
|
|
The version command returns a single JSON object.
|
|
|
|
|
2024-08-03 20:20:56 +00:00
|
|
|
+------------------+--------------------+
|
|
|
|
| ``message_type`` | Always "version" |
|
|
|
|
+------------------+--------------------+
|
|
|
|
| ``version`` | restic version |
|
|
|
|
+------------------+--------------------+
|
|
|
|
| ``go_version`` | Go compile version |
|
|
|
|
+------------------+--------------------+
|
|
|
|
| ``go_os`` | Go OS |
|
|
|
|
+------------------+--------------------+
|
|
|
|
| ``go_arch`` | Go architecture |
|
|
|
|
+------------------+--------------------+
|