summaryrefslogtreecommitdiffstats
path: root/modules.d
diff options
context:
space:
mode:
authorSimon Rettberg2025-04-02 09:58:37 +0200
committerSimon Rettberg2025-04-02 09:58:37 +0200
commit9ca7247803bf250e24e6f7d262f0efc6732505a3 (patch)
treef3a96d3d9e8712e52a6a3e34348d4bda52fbcdde /modules.d
parent[slx-watchdog] Add custom watchdog to stage 3 (diff)
downloadsystemd-init-9ca7247803bf250e24e6f7d262f0efc6732505a3.tar.gz
systemd-init-9ca7247803bf250e24e6f7d262f0efc6732505a3.tar.xz
systemd-init-9ca7247803bf250e24e6f7d262f0efc6732505a3.zip
[slx-watchdog] Run after network (guess URL), check if shell was dropped
Diffstat (limited to 'modules.d')
-rwxr-xr-xmodules.d/slx-watchdog/hooks/s3-watchdog.sh11
-rwxr-xr-xmodules.d/slx-watchdog/module-setup.sh4
2 files changed, 11 insertions, 4 deletions
diff --git a/modules.d/slx-watchdog/hooks/s3-watchdog.sh b/modules.d/slx-watchdog/hooks/s3-watchdog.sh
index 2064ad97..3e7f342b 100755
--- a/modules.d/slx-watchdog/hooks/s3-watchdog.sh
+++ b/modules.d/slx-watchdog/hooks/s3-watchdog.sh
@@ -3,8 +3,15 @@
sleep 30 # Hopefully enough - usually takes 3-4 seconds from here
# We didn't get killed in time - send report
-. /etc/openslx
-[ -z "$SLX_REMOTE_LOG" ] && exit 1
+[ -s /etc/openslx ] && . /etc/openslx
+if [ -z "$SLX_REMOTE_LOG" ]; then
+ # Guess the URL - maybe downloading the config failed
+ slxsrv="$( grep -oPm1 '(?<=\bslxsrv=)\S*' /proc/cmdline)"
+ [ -z "$slxsrv" ] && exit 1
+ SLX_REMOTE_LOG="http://${slxsrv}/slx-admin/api.php?do=clientlog"
+fi
+
+[ -e /.console_lock ] && exit 0 # We dropped a shell, ignore
echo "SLX-Watchdog timed out, sending debug report"
journalctl -b > /tmp/journal.txt
diff --git a/modules.d/slx-watchdog/module-setup.sh b/modules.d/slx-watchdog/module-setup.sh
index 26df4a34..ca60c106 100755
--- a/modules.d/slx-watchdog/module-setup.sh
+++ b/modules.d/slx-watchdog/module-setup.sh
@@ -13,8 +13,8 @@ install() {
--requires "initrd-root-fs.target"
slx_service "s3-watchdog" "Send error report to server if we stay in stage3 for too long" \
--type "simple" \
- --after "s3-fetch-config.service" \
- --requires "s3-fetch-config.service"
+ --after "s3-setup-bootif-network.service" \
+ --requires "s3-setup-bootif-network.service"
# Try to enforce nowayout for all watchdogs
inst_simple "$moddir/data/slx-nowayout.conf" "/etc/modprobe.d/slx-nowayout.conf"
}