Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for backup from stdin #8

Open
andreasnuesslein opened this issue Nov 21, 2018 · 1 comment
Open

support for backup from stdin #8

andreasnuesslein opened this issue Nov 21, 2018 · 1 comment

Comments

@andreasnuesslein
Copy link
Member

https://restic.readthedocs.io/en/latest/040_backup.html#reading-data-from-stdin

@darkdragon-001
Copy link

darkdragon-001 commented May 25, 2020

This is a blocker for me ATM.

I imagine config like:

[backup]
commands = [
    ["/usr/bin/myprog --opt", "/path/backup.filename"],
    ]

Python code would be as easy as:

import subprocess
for command in commands:
    proc_stdin = subprocess.Popen(command[0], stdout=subprocess.PIPE)
    proc_restic = subprocess.Popen(["restic","--stdin","--stdin-filename",command[1]], stdin=proc_stdin.stdout)

proc_stdin.wait()
proc_restic.wait()

You might also want to check for proc_stdin.returncode and make sure the backup fails when a non-zero return code is passed.

You might want to multiply the stream for all repositories by using tee() in order to run it only once. One limitation could be to only allow retry_count = 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants