summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-07-28 13:28:23 +0200
committerErich Eckner <git@eckner.net>2022-07-28 13:28:23 +0200
commitc06bf9e5efe0179c26d201ba32251a19a4557c33 (patch)
treeac404207df5a5800d7e72b21df613914dab86c6b
parent207a3e9fc1be53683d2dcc74f1640b446742aff8 (diff)
downloadraspi-lights-out-c06bf9e5efe0179c26d201ba32251a19a4557c33.tar.xz
add service and timer for colocation update
-rw-r--r--.gitignore2
-rw-r--r--Makefile4
-rw-r--r--lights-out-colocation-update.service.in8
-rw-r--r--lights-out-colocation-update.timer.in10
4 files changed, 22 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index b9bf5ae..5c949d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
index.php
+lights-out-colocation-update.service
+lights-out-colocation-update.timer
lights-out-init.service
lights-out
lights-out@.service
diff --git a/Makefile b/Makefile
index d1a9a3c..5afc21b 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ HTTPDIR = /srv/http/lights-out
VERSION = 0.2
-all: index.php lights-out lights-out-init.service lights-out@.service
+all: index.php lights-out lights-out-init.service lights-out@.service lights-out-colocation-update.service lights-out-colocation-update.timer
%: %.in
sed " \
@@ -43,7 +43,7 @@ all: index.php lights-out lights-out-init.service lights-out@.service
install: all
install -D -m0755 -t $(DESTDIR)$(BINDIR) lights-out
- install -D -m0644 -t $(DESTDIR)$(LIBDIR)/systemd/system lights-out@.service lights-out-init.service
+ install -D -m0644 -t $(DESTDIR)$(LIBDIR)/systemd/system lights-out@.service lights-out-init.service lights-out-colocation-update.service lights-out-colocation-update.timer
install -D -m0644 -t $(DESTDIR)$(ETCDIR) lights-out.conf
install -D -m0644 -t $(DESTDIR)$(HTTPDIR)/httpdocs index.php
install -D -m0600 -o http -g http /dev/null $(DESTDIR)$(HTTPDIR)/password
diff --git a/lights-out-colocation-update.service.in b/lights-out-colocation-update.service.in
new file mode 100644
index 0000000..9491eb4
--- /dev/null
+++ b/lights-out-colocation-update.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=lights out update colocation
+Needs=lights-out-init.service
+After=lights-out-init.service
+
+[Service]
+Type=oneshot
+ExecStart=#BINDIR#/lights-out colocation update
diff --git a/lights-out-colocation-update.timer.in b/lights-out-colocation-update.timer.in
new file mode 100644
index 0000000..115cde8
--- /dev/null
+++ b/lights-out-colocation-update.timer.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=update colocation every few minutes
+
+[Timer]
+OnCalendar=*:*/10:00
+RandomizedDelaySec=600
+FixedRandomDelay=True
+
+[Install]
+WantedBy=timers.target