2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-26 04:17:29 +00:00

Merge pull request #4939 from MichaelEischer/fix-stdin-command-docs

docs: clarify how to pass arguments using backup --stdin-from-command
This commit is contained in:
Michael Eischer 2024-07-26 20:17:00 +00:00 committed by GitHub
commit 76d56e24d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -584,11 +584,13 @@ Reading data from a command
Sometimes, it can be useful to directly save the output of a program, for example,
``mysqldump`` so that the SQL can later be restored. Restic supports this mode
of operation; just supply the option ``--stdin-from-command`` when using the
``backup`` action, and write the command in place of the files/directories:
``backup`` action, and write the command in place of the files/directories. To prevent
restic from interpreting the arguments for the commmand, make sure to add ``--`` before
the command starts:
.. code-block:: console
$ restic -r /srv/restic-repo backup --stdin-from-command mysqldump [...]
$ restic -r /srv/restic-repo backup --stdin-from-command -- mysqldump --host example mydb [...]
This command creates a new snapshot based on the standard output of ``mysqldump``.
By default, the command's standard output is saved in a file named ``stdin``.
@ -596,7 +598,7 @@ A different name can be specified with ``--stdin-filename``:
.. code-block:: console
$ restic -r /srv/restic-repo backup --stdin-filename production.sql --stdin-from-command mysqldump [...]
$ restic -r /srv/restic-repo backup --stdin-filename production.sql --stdin-from-command -- mysqldump --host example mydb [...]
Restic uses the command exit code to determine whether the command succeeded. A
non-zero exit code from the command causes restic to cancel the backup. This causes