diff options
author | Andrew Cady <d@jerkface.net> | 2023-05-25 00:30:15 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-05-25 10:01:05 -0400 |
commit | 3f9e25417cd8eca5260b634bec806bd78d704c04 (patch) | |
tree | 799c9fe3cec16c77b12fdf620752232dae832bfc | |
parent | 293d79dde8fd6c3006b74b2b5131362bb7cdd82f (diff) |
renames
-rw-r--r-- | Makefile | 6 | ||||
-rwxr-xr-x | src/push-btrfs | 2 | ||||
-rw-r--r-- | src/push-btrfs.service | 4 | ||||
-rw-r--r-- | src/push-btrfs.timer | 2 | ||||
-rw-r--r-- | src/push-btrfs@.service | 4 |
5 files changed, 10 insertions, 8 deletions
@@ -1,4 +1,5 @@ | |||
1 | config_dir = /etc/btrfs-backup/remotes | 1 | config_dir = /etc/btrfs/remotes |
2 | bindir = /usr/local/bin | ||
2 | main_unit_name = push-btrfs | 3 | main_unit_name = push-btrfs |
3 | remotes = $(notdir $(basename $(wildcard $(config_dir)/*.json))) | 4 | remotes = $(notdir $(basename $(wildcard $(config_dir)/*.json))) |
4 | timers = $(addprefix $(main_unit_name)@, $(addsuffix .timer, $(remotes))) | 5 | timers = $(addprefix $(main_unit_name)@, $(addsuffix .timer, $(remotes))) |
@@ -11,12 +12,13 @@ unit_files = $(wildcard src/*.service src/*.timer) | |||
11 | plain_units = $(enable_unit) $(shell printf '%s\n' $(notdir $(unit_files)) | grep -v '@') | 12 | plain_units = $(enable_unit) $(shell printf '%s\n' $(notdir $(unit_files)) | grep -v '@') |
12 | template_units = $(timers) $(services) | 13 | template_units = $(timers) $(services) |
13 | units = $(plain_units) $(template_units) | 14 | units = $(plain_units) $(template_units) |
14 | 15 | binaries = $(addprefix src/,push-btrfs retain-snapshots) | |
15 | 16 | ||
16 | 17 | ||
17 | 18 | ||
18 | 19 | ||
19 | install: | 20 | install: |
21 | install -t $(bindir) -- $(binaries) | ||
20 | systemctl link $(addprefix ./, $(unit_files)) | 22 | systemctl link $(addprefix ./, $(unit_files)) |
21 | systemctl reset-failed $(units) | 23 | systemctl reset-failed $(units) |
22 | systemctl enable --now $(enable_unit) | 24 | systemctl enable --now $(enable_unit) |
diff --git a/src/push-btrfs b/src/push-btrfs index 3284b69..a534053 100755 --- a/src/push-btrfs +++ b/src/push-btrfs | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | MIN_AGE_SECONDS=60 | 2 | MIN_AGE_SECONDS=60 |
3 | CONFIG_DIR=/etc/btrfs-backup/remotes | 3 | CONFIG_DIR=/etc/btrfs/remotes |
4 | 4 | ||
5 | die() | 5 | die() |
6 | { | 6 | { |
diff --git a/src/push-btrfs.service b/src/push-btrfs.service index c4ab87c..0fd8466 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 | ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json | 4 | ConditionPathExistsGlob = /etc/btrfs/remotes/*.json |
5 | 5 | ||
6 | [Service] | 6 | [Service] |
7 | WorkingDirectory = /etc/btrfs-backup/remotes | 7 | WorkingDirectory = /etc/btrfs/remotes |
8 | ExecStart = bash -e -c '\ | 8 | ExecStart = bash -e -c '\ |
9 | shopt -s failglob; \ | 9 | shopt -s failglob; \ |
10 | units=(*.json); \ | 10 | units=(*.json); \ |
diff --git a/src/push-btrfs.timer b/src/push-btrfs.timer index 4bfb418..79de8af 100644 --- a/src/push-btrfs.timer +++ b/src/push-btrfs.timer | |||
@@ -1,6 +1,6 @@ | |||
1 | [Unit] | 1 | [Unit] |
2 | Description = Btrfs Backup over SSH | 2 | Description = Btrfs Backup over SSH |
3 | ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json | 3 | ConditionPathExistsGlob = /etc/btrfs/remotes/*.json |
4 | 4 | ||
5 | [Timer] | 5 | [Timer] |
6 | OnUnitInactiveSec=5 | 6 | OnUnitInactiveSec=5 |
diff --git a/src/push-btrfs@.service b/src/push-btrfs@.service index c62febe..47a82ef 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-backup/remotes/%I.json | 4 | ConditionFileNotEmpty = /etc/btrfs/remotes/%I.json |
5 | 5 | ||
6 | [Service] | 6 | [Service] |
7 | ExecStart = /root/src/local-btrfs-backup/src/push-btrfs %I.json | 7 | ExecStart = push-btrfs %I.json |
8 | 8 | ||
9 | [Install] | 9 | [Install] |
10 | WantedBy=default.target | 10 | WantedBy=default.target |