]> git.etc.gen.nz Git - mythtv-status.git/commitdiff
Install systemd services and timers for regular tasks
authorAndrew Ruthven <andrew@etc.gen.nz>
Sat, 15 Jul 2023 13:11:17 +0000 (01:11 +1200)
committerAndrew Ruthven <andrew@etc.gen.nz>
Sun, 16 Jul 2023 04:17:12 +0000 (16:17 +1200)
debian/changelog
debian/cron.daily
debian/dirs
debian/health-check [new file with mode: 0755]
debian/install
debian/mythtv-status_health-check.service [new file with mode: 0644]
debian/mythtv-status_health-check.timer [new file with mode: 0644]
debian/mythtv-status_update-motd.service [new file with mode: 0644]
debian/mythtv-status_update-motd.timer [new file with mode: 0644]
debian/rules

index fe98ee4df1ca65d88e13e9a246709b512f569336..355d37a823216b2c9b36c4bed50fb0ceb4521b82 100644 (file)
@@ -10,6 +10,7 @@ mythtv-status (1.0.2-1) UNRELEASED; urgency=medium
   * Drop versioned dependency on molly-guard, 0.4 was released in 2008. 
   * Move libmythtv-perl to by a Suggests, as it is doesn't exist in the
     official Debian repo. 
+  * Install systemd services and timers for regular tasks.
 
  -- Andrew Ruthven <andrew@etc.gen.nz>  Sun, 06 Dec 2020 22:51:12 +1300
 
index 5bab4e92085f69a5461d6c87727b404dca5d7416..34cc283ea300c5156ae64bc8ba407e3b4c00d374 100644 (file)
@@ -1,13 +1,7 @@
 #!/bin/sh
 
-. /etc/default/mythtv-status
-
-if [ "x$EMAIL" = "x" -o "x$EMAIL" = "xnone" ]
-then
-  exit
-fi
-
-/usr/bin/mythtv-status --host $HOST --email $EMAIL $EMAIL_ARGS
+[ -x /usr/lib/mythtv-status/health-check ] \
+    && /usr/local/mythtv-status/health-check
 
 # Keep run-parts happy by always returning with a return code of 0.
 exit 0
index 6f498a6815a2a32fdd934250a2cf979976a81707..6f402ebfe607e2ef55d8f21d1ce2fd626b95c85f 100644 (file)
@@ -1,2 +1,3 @@
 usr/bin
+usr/libexec/mythtv-status
 var/lib/mythtv-status
diff --git a/debian/health-check b/debian/health-check
new file mode 100755 (executable)
index 0000000..39e739c
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Copyright (c) 2007-2023 Andrew Ruthven <andrew@etc.gen.nz>
+# This code is hereby licensed for public consumption under the GNU GPL v3.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+# Run mythtv-status to perform a health check of the MythTV system.
+
+. /etc/default/mythtv-status
+
+if [ "$EMAIL" = "" ] || [ "$EMAIL" = "none" ]
+then
+  exit
+fi
+
+/usr/bin/mythtv-status --host "$HOST" --email "$EMAIL" "$EMAIL_ARGS"
+
+# Keep things happy by always having a return code of 0.
+exit 0
index e9c997bb9bf3c7a65dfbdd0c802122c84f0662f0..741d3191b52b948d563bfd1edf26bf71b9743e3c 100644 (file)
@@ -1,4 +1,9 @@
 bin/mythtv-update-motd /usr/sbin
+debian/health-check usr/libexec/mythtv-status
+debian/lintian/overrides/mythtv-status usr/share/lintian/overrides
+debian/mythtv-status_health-check.service lib/systemd/system
+debian/mythtv-status_health-check.timer lib/systemd/system
+debian/mythtv-status_update-motd.service lib/systemd/system
+debian/mythtv-status_update-motd.timer lib/systemd/system
 molly-guard/40-mythtv-recording-soon etc/molly-guard/run.d
 update-motd.d/50-mythtv-status etc/update-motd.d
-debian/lintian/overrides/mythtv-status usr/share/lintian/overrides
diff --git a/debian/mythtv-status_health-check.service b/debian/mythtv-status_health-check.service
new file mode 100644 (file)
index 0000000..6948fa8
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=Daily mythtv-status health check of MythTV
+Documentation=man:mythtv-status(1)
+
+[Service]
+Type=oneshot
+ExecStart=/usr/lib/mythtv-status/health-check
diff --git a/debian/mythtv-status_health-check.timer b/debian/mythtv-status_health-check.timer
new file mode 100644 (file)
index 0000000..f169d7e
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Daily mythtv-status health check of MythTV
+Documentation=man:mythtv-status(1)
+
+[Timer]
+OnCalendar=Daily
+OnBootSec=15min
+
+[Install]
+WantedBy=timers.target
diff --git a/debian/mythtv-status_update-motd.service b/debian/mythtv-status_update-motd.service
new file mode 100644 (file)
index 0000000..c044662
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=mythtv-status MOTD update
+Documentation=man:mythtv-update-motd(1)
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/mythtv-update-motd
diff --git a/debian/mythtv-status_update-motd.timer b/debian/mythtv-status_update-motd.timer
new file mode 100644 (file)
index 0000000..09dfcd9
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=mythtv-status MOTD update
+Documentation=man:mythtv-update-motd(1)
+
+[Timer]
+OnCalendar=*-*-* *:00,15,30,45
+OnBootSec=60
+
+[Install]
+WantedBy=timers.target
index 218df65d8273ae2772689b80d4a39a5ac15312be..4380aee9fc5745f765d6040d8cc9bf3bbd6e2b7f 100755 (executable)
@@ -6,3 +6,10 @@
 
 %:
        dh $@
+
+override_dh_installsystemd:
+       dh_installsystemd mythtv-status.service \
+           mythtv-status_health-check.service  \
+           mythtv-status_health-check.timer    \
+           mythtv-status_update-motd.service   \
+           mythtv-status_update-motd.timer