add hourly /var/home snapshot script and cronjob

This commit is contained in:
Anders Rytter Hansen 2023-11-09 21:55:15 +01:00
commit 9d952af895
2 changed files with 11 additions and 0 deletions

3
etc/cron.hourly/2snapshot Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
python3 "/usr/bin/snapshot-home.py"

8
usr/bin/snapshot-home.py Executable file
View file

@ -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)