diff options
author | Andrew Cady <d@jerkface.net> | 2023-05-25 10:20:14 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-05-25 10:20:14 -0400 |
commit | 3b0ecb25bf5e032b5cc0232040fca854f01d297b (patch) | |
tree | d097019e945964884936d23d809ac6f2ca840da6 | |
parent | 3f9e25417cd8eca5260b634bec806bd78d704c04 (diff) |
systemd fixes
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | src/push-btrfs@.service | 4 |
2 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,6 @@ | |||
1 | config_dir = /etc/btrfs/remotes | 1 | config_dir = /etc/btrfs/remotes |
2 | bindir = /usr/local/bin | 2 | bindir = /usr/local/bin |
3 | unitdir = /etc/systemd/system | ||
3 | main_unit_name = push-btrfs | 4 | main_unit_name = push-btrfs |
4 | remotes = $(notdir $(basename $(wildcard $(config_dir)/*.json))) | 5 | remotes = $(notdir $(basename $(wildcard $(config_dir)/*.json))) |
5 | timers = $(addprefix $(main_unit_name)@, $(addsuffix .timer, $(remotes))) | 6 | timers = $(addprefix $(main_unit_name)@, $(addsuffix .timer, $(remotes))) |
@@ -16,10 +17,10 @@ binaries = $(addprefix src/,push-btrfs retain-snapshots) | |||
16 | 17 | ||
17 | 18 | ||
18 | 19 | ||
19 | |||
20 | install: | 20 | install: |
21 | install -t $(bindir) -- $(binaries) | 21 | install -t $(bindir) -- $(binaries) |
22 | systemctl link $(addprefix ./, $(unit_files)) | 22 | install -m644 -t $(unitdir) -- $(unit_files) |
23 | systemctl daemon-reload | ||
23 | systemctl reset-failed $(units) | 24 | systemctl reset-failed $(units) |
24 | systemctl enable --now $(enable_unit) | 25 | systemctl enable --now $(enable_unit) |
25 | 26 | ||
diff --git a/src/push-btrfs@.service b/src/push-btrfs@.service index 47a82ef..fcc7d72 100644 --- a/src/push-btrfs@.service +++ b/src/push-btrfs@.service | |||
@@ -1,10 +1,10 @@ | |||
1 | [Unit] | 1 | [Unit] |
2 | Description = Btrfs Backup over SSH | 2 | Description = Btrfs Backup over SSH |
3 | ConditionUser = root | 3 | ConditionUser = root |
4 | ConditionFileNotEmpty = /etc/btrfs/remotes/%I.json | 4 | ConditionFileNotEmpty = /etc/btrfs/remotes/%i.json |
5 | 5 | ||
6 | [Service] | 6 | [Service] |
7 | ExecStart = push-btrfs %I.json | 7 | ExecStart = push-btrfs %i.json |
8 | 8 | ||
9 | [Install] | 9 | [Install] |
10 | WantedBy=default.target | 10 | WantedBy=default.target |