sinnwerkstatt/runrestic

support for backup from stdin

andreasnuesslein opened this issue · 1 comments

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.