summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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