diff options
author | Andrew Cady <d@jerkface.net> | 2023-05-22 18:07:04 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-05-22 18:07:04 -0400 |
commit | 8a0d793a556a4df9bd6a2023843db4bec42ea0a1 (patch) | |
tree | 1a45d1e343939cb8ba4876138dfa3f3e08f0c966 | |
parent | 39722e736c57bd54c0878fffc68d082f43b987ac (diff) |
improvements
-rw-r--r-- | push-btrfs.service | 9 | ||||
-rw-r--r-- | push-btrfs.timer | 4 |
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] |
2 | Description = Btrfs Backup over SSH | 2 | Description = Btrfs Backup over SSH |
3 | ConditionUser = root | 3 | ConditionUser = root |
4 | ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json | ||
4 | 5 | ||
5 | [Service] | 6 | [Service] |
6 | WorkingDirectory = /etc/btrfs-backup/remotes | 7 | WorkingDirectory = /etc/btrfs-backup/remotes |
7 | ExecStart = bash -c 'shopt -s nullglob; for f in *.json; do (set -x; systemctl enable push-btrfs@$$f.timer); done' | 8 | ExecStart = 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] |
10 | WantedBy=default.target | 17 | WantedBy=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] | ||
2 | Description = Btrfs Backup over SSH | ||
3 | ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json | ||
4 | |||
1 | [Timer] | 5 | [Timer] |
2 | OnUnitInactiveSec=5 | 6 | OnUnitInactiveSec=5 |
3 | 7 | ||