diff options
Diffstat (limited to 'push-btrfs.service')
-rw-r--r-- | push-btrfs.service | 9 |
1 files changed, 8 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 |