summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2023-05-22 01:23:42 -0400
committerAndrew Cady <d@jerkface.net>2023-05-22 01:23:42 -0400
commit684c592ac659de0d934f5c9a47d28348d12e723e (patch)
tree5e04bf3435c3cdb7a5b43f3c6882a3d979b5e064
parent5dcbbaeb2c942356f3b9b7dba5e04ec373adfced (diff)
systemd units
-rw-r--r--Makefile3
-rw-r--r--push-btrfs@.service10
-rw-r--r--push-btrfs@.timer5
3 files changed, 18 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 327ab68..ac0ab02 100644
--- a/Makefile
+++ b/Makefile
@@ -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)>).
6endif 6endif
7 7
8install:
9 for remote in $(remotes); do systemctl enable push-btrfs@$$remote.service; systemctl enable --now push-btrfs@$$remote.timer; done
10
8go: 11go:
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]
2Description = Btrfs Backup over SSH
3ConditionUser = root
4ConditionFileNotEmpty = /etc/btrfs-backup/remotes/%I.json
5
6[Service]
7ExecStart = /root/src/local-btrfs-backup/push-btrfs %I.json
8
9[Install]
10WantedBy=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]
2OnUnitInactiveSec=61
3
4[Install]
5WantedBy=default.target