From 9d952af895eba12c19f70b58606377343b9e6c04 Mon Sep 17 00:00:00 2001 From: Anders Rytter Hansen Date: Thu, 9 Nov 2023 21:55:15 +0100 Subject: [PATCH] add hourly /var/home snapshot script and cronjob --- etc/cron.hourly/2snapshot | 3 +++ usr/bin/snapshot-home.py | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100755 etc/cron.hourly/2snapshot create mode 100755 usr/bin/snapshot-home.py diff --git a/etc/cron.hourly/2snapshot b/etc/cron.hourly/2snapshot new file mode 100755 index 0000000..ffc03c8 --- /dev/null +++ b/etc/cron.hourly/2snapshot @@ -0,0 +1,3 @@ +#!/bin/sh + +python3 "/usr/bin/snapshot-home.py" diff --git a/usr/bin/snapshot-home.py b/usr/bin/snapshot-home.py new file mode 100755 index 0000000..e7d02db --- /dev/null +++ b/usr/bin/snapshot-home.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 -u + +import os +import datetime + +stream = os.popen('btrfs subvolume snapshot /var/home /var/.snapshot.home/' + datetime.datetime.now().strftime("%Y.%m.%d_%H:%M:%S") + '/') +output = stream.read() +print(output)