Major repo reorganizaion

This commit is contained in:
Einar Forselv
2019-04-15 16:16:06 +02:00
parent f76c91e549
commit fc6ecd951d
8 changed files with 78 additions and 50 deletions

View File

@@ -0,0 +1,51 @@
import os
from subprocess import Popen, PIPE, check_call
def init_repo(repository):
run_command([
"restic",
"-r",
repository,
"init",
])
def backup_volume(repository, volume):
run_command([
"restic",
"-r",
repository,
"--verbose",
"backup",
volume.destination,
])
def snapshots(repository):
run_command([
"restic",
"-r",
repository,
"snapshots",
])
def check(repository):
run_command([
"restic",
"-r",
repository,
"check",
])
def run_command(cmd):
child = Popen(cmd, stdout=PIPE, stderr=PIPE)
stdoutdata, stderrdata = child.communicate()
if stdoutdata:
print(stdoutdata.decode())
if stderrdata:
print(stderrdata.decode())