summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2023-05-22 18:07:04 -0400
committerAndrew Cady <d@jerkface.net>2023-05-22 18:07:04 -0400
commit8a0d793a556a4df9bd6a2023843db4bec42ea0a1 (patch)
tree1a45d1e343939cb8ba4876138dfa3f3e08f0c966
parent39722e736c57bd54c0878fffc68d082f43b987ac (diff)
improvements
-rw-r--r--push-btrfs.service9
-rw-r--r--push-btrfs.timer4
2 files changed, 12 insertions, 1 deletions
diff --git a/push-btrfs.service b/push-btrfs.service
index ec9d3cd..7d32080 100644
--- a/push-btrfs.service
+++ b/push-btrfs.service
@@ -1,10 +1,17 @@
1[Unit] 1[Unit]
2Description = Btrfs Backup over SSH 2Description = Btrfs Backup over SSH
3ConditionUser = root 3ConditionUser = root
4ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json
4 5
5[Service] 6[Service]
6WorkingDirectory = /etc/btrfs-backup/remotes 7WorkingDirectory = /etc/btrfs-backup/remotes
7ExecStart = bash -c 'shopt -s nullglob; for f in *.json; do (set -x; systemctl enable push-btrfs@$$f.timer); done' 8ExecStart = bash -e -c 'shopt -s failglob; \
9 units=(*.json); \
10 units=($${units[@]/.json/.timer}); \
11 units=($${units[@]/#/%p@}); \
12 systemctl enable "$${units[@]}"; \
13 entr -pnd -- true <<< . || true; \
14 '
8 15
9[Install] 16[Install]
10WantedBy=default.target 17WantedBy=default.target
diff --git a/push-btrfs.timer b/push-btrfs.timer
index 982df5c..4bfb418 100644
--- a/push-btrfs.timer
+++ b/push-btrfs.timer
@@ -1,3 +1,7 @@
1[Unit]
2Description = Btrfs Backup over SSH
3ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json
4
1[Timer] 5[Timer]
2OnUnitInactiveSec=5 6OnUnitInactiveSec=5
3 7