summaryrefslogtreecommitdiffstats
path: root/satellit_installer/static_files
diff options
context:
space:
mode:
authorSimon Rettberg2024-04-30 14:35:50 +0200
committerSimon Rettberg2024-04-30 14:35:50 +0200
commit5771141861933d92c8cd001ce3bc7861bf66aa29 (patch)
tree8f66c37e05151b720586a36fc34aa82373294a9f /satellit_installer/static_files
parent[SS?S] Split static_files/system into base and updates (diff)
downloadsetup-scripts-5771141861933d92c8cd001ce3bc7861bf66aa29.tar.gz
setup-scripts-5771141861933d92c8cd001ce3bc7861bf66aa29.tar.xz
setup-scripts-5771141861933d92c8cd001ce3bc7861bf66aa29.zip
[SS?S] Add dpkg hook to restart java services on update
Diffstat (limited to 'satellit_installer/static_files')
-rw-r--r--satellit_installer/static_files/system-updates/etc/apt/apt.conf.d/80java-restart1
-rw-r--r--satellit_installer/static_files/system-updates/etc/cron.d/java-restart-init1
-rwxr-xr-xsatellit_installer/static_files/system-updates/opt/openslx/dpkg-post.sh17
3 files changed, 19 insertions, 0 deletions
diff --git a/satellit_installer/static_files/system-updates/etc/apt/apt.conf.d/80java-restart b/satellit_installer/static_files/system-updates/etc/apt/apt.conf.d/80java-restart
new file mode 100644
index 0000000..bf50988
--- /dev/null
+++ b/satellit_installer/static_files/system-updates/etc/apt/apt.conf.d/80java-restart
@@ -0,0 +1 @@
+DPkg::Post-Invoke { "/opt/openslx/dpkg-post.sh"; };
diff --git a/satellit_installer/static_files/system-updates/etc/cron.d/java-restart-init b/satellit_installer/static_files/system-updates/etc/cron.d/java-restart-init
new file mode 100644
index 0000000..c563036
--- /dev/null
+++ b/satellit_installer/static_files/system-updates/etc/cron.d/java-restart-init
@@ -0,0 +1 @@
+@reboot root /opt/openslx/dpkg-post.sh --boot
diff --git a/satellit_installer/static_files/system-updates/opt/openslx/dpkg-post.sh b/satellit_installer/static_files/system-updates/opt/openslx/dpkg-post.sh
new file mode 100755
index 0000000..ab07bba
--- /dev/null
+++ b/satellit_installer/static_files/system-updates/opt/openslx/dpkg-post.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+laststamp=$( cat /run/openslx/java-ts 2> /dev/null )
+
+s="$( stat -c %Y /usr/lib/jvm/*/bin/java /usr/lib/jvm/*/lib/jspawnhelper | sort -n | tail -n 1 )"
+
+# Nothing changed?
+[ "$s" = "$laststamp" ] && exit 0
+
+if [ -z "$laststamp" ] || [ "$1" = "--boot" ]; then
+ mkdir -p /run/openslx/
+else
+ systemctl --no-block try-restart dmsd.service taskmanager.service
+fi
+
+echo "$s" > /run/openslx/java-ts
+exit 0