summaryrefslogtreecommitdiff
path: root/snap.py
diff options
context:
space:
mode:
Diffstat (limited to 'snap.py')
-rwxr-xr-xsnap.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/snap.py b/snap.py
index 68a62c7c..3d9c315a 100755
--- a/snap.py
+++ b/snap.py
@@ -13,6 +13,7 @@ from tempfile import TemporaryDirectory
13import pathlib 13import pathlib
14 14
15import unshare 15import unshare
16import signal
16 17
17 18
18def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args): 19def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args):
@@ -66,7 +67,7 @@ def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args):
66 '--chunker-params=10,23,16,4095', 67 '--chunker-params=10,23,16,4095',
67 f'--timestamp={creation_time.strftime("%Y-%m-%dT%H:%M:%S")}', 68 f'--timestamp={creation_time.strftime("%Y-%m-%dT%H:%M:%S")}',
68 '--show-rc', 69 '--show-rc',
69 '--progress', 70 # '--progress',
70 '--list', 71 '--list',
71 '--filter=AMEi-x?', 72 '--filter=AMEi-x?',
72 '--stats', 73 '--stats',
@@ -91,7 +92,12 @@ def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args):
91 finally: 92 finally:
92 subprocess.run(['lvremove', '--force', sn], stdin=subprocess.DEVNULL, check=True) 93 subprocess.run(['lvremove', '--force', sn], stdin=subprocess.DEVNULL, check=True)
93 94
95def sigterm(signum, frame):
96 raise SystemExit(128 + signum)
97
94def main(): 98def main():
99 signal.signal(signal.SIGTERM, sigterm)
100
95 parser = argparse.ArgumentParser() 101 parser = argparse.ArgumentParser()
96 parser.add_argument('lv', metavar='LV') 102 parser.add_argument('lv', metavar='LV')
97 parser.add_argument('--size-percent', metavar='PERCENT', type = float, default=10) 103 parser.add_argument('--size-percent', metavar='PERCENT', type = float, default=10)