diff options
author | Andrew Cady <d@jerkface.net> | 2023-05-22 01:23:42 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-05-22 01:23:42 -0400 |
commit | 684c592ac659de0d934f5c9a47d28348d12e723e (patch) | |
tree | 5e04bf3435c3cdb7a5b43f3c6882a3d979b5e064 | |
parent | 5dcbbaeb2c942356f3b9b7dba5e04ec373adfced (diff) |
systemd units
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | push-btrfs@.service | 10 | ||||
-rw-r--r-- | push-btrfs@.timer | 5 |
3 files changed, 18 insertions, 0 deletions
@@ -5,5 +5,8 @@ ifeq ($(remotes),) | |||
5 | $(error You must put at least one *.json configuration file into <file:///$(config_dir)>). | 5 | $(error You must put at least one *.json configuration file into <file:///$(config_dir)>). |
6 | endif | 6 | endif |
7 | 7 | ||
8 | install: | ||
9 | for remote in $(remotes); do systemctl enable push-btrfs@$$remote.service; systemctl enable --now push-btrfs@$$remote.timer; done | ||
10 | |||
8 | go: | 11 | go: |
9 | for remote in $(remotes); do bash$(if $(verbose), -x) push-btrfs $$remote$(if $(verbose),;, &) done; wait | 12 | for remote in $(remotes); do bash$(if $(verbose), -x) push-btrfs $$remote$(if $(verbose),;, &) done; wait |
diff --git a/push-btrfs@.service b/push-btrfs@.service new file mode 100644 index 0000000..9eb1713 --- /dev/null +++ b/push-btrfs@.service | |||
@@ -0,0 +1,10 @@ | |||
1 | [Unit] | ||
2 | Description = Btrfs Backup over SSH | ||
3 | ConditionUser = root | ||
4 | ConditionFileNotEmpty = /etc/btrfs-backup/remotes/%I.json | ||
5 | |||
6 | [Service] | ||
7 | ExecStart = /root/src/local-btrfs-backup/push-btrfs %I.json | ||
8 | |||
9 | [Install] | ||
10 | WantedBy=default.target | ||
diff --git a/push-btrfs@.timer b/push-btrfs@.timer new file mode 100644 index 0000000..acabfe5 --- /dev/null +++ b/push-btrfs@.timer | |||
@@ -0,0 +1,5 @@ | |||
1 | [Timer] | ||
2 | OnUnitInactiveSec=61 | ||
3 | |||
4 | [Install] | ||
5 | WantedBy=default.target | ||