From 7d5817dfcd5f93e56f770353059ba845314f9646 Mon Sep 17 00:00:00 2001
From: David Vazgenovich Shakaryan <dvshakaryan@gmail.com>
Date: Thu, 8 Dec 2022 18:42:54 -0800
Subject: add systemd service and timer

---
 systemd/linode-ddns@.service                             | 6 ++++++
 systemd/linode-ddns@.timer                               | 9 +++++++++
 systemd/linode-ddns@home.example.org.service.d/opts.conf | 4 ++++
 3 files changed, 19 insertions(+)
 create mode 100644 systemd/linode-ddns@.service
 create mode 100644 systemd/linode-ddns@.timer
 create mode 100644 systemd/linode-ddns@home.example.org.service.d/opts.conf

diff --git a/systemd/linode-ddns@.service b/systemd/linode-ddns@.service
new file mode 100644
index 0000000..35905b4
--- /dev/null
+++ b/systemd/linode-ddns@.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=Linode DDNS updater
+
+[Service]
+Type=oneshot
+ExecStart=linode-ddns.sh "${DOMAIN}" "${RECORD}"
diff --git a/systemd/linode-ddns@.timer b/systemd/linode-ddns@.timer
new file mode 100644
index 0000000..d87ed06
--- /dev/null
+++ b/systemd/linode-ddns@.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Regular updates of Linode DDNS
+
+[Timer]
+OnBootSec=2m
+OnUnitActiveSec=30m
+
+[Install]
+WantedBy=timers.target
diff --git a/systemd/linode-ddns@home.example.org.service.d/opts.conf b/systemd/linode-ddns@home.example.org.service.d/opts.conf
new file mode 100644
index 0000000..da136e7
--- /dev/null
+++ b/systemd/linode-ddns@home.example.org.service.d/opts.conf
@@ -0,0 +1,4 @@
+[Service]
+Environment="LINODE_TOKEN=access_token"
+Environment="DOMAIN=example.org"
+Environment="RECORD=home"
-- 
cgit v1.2.3-70-g09d2