🐛 Backend: Enhanced HTTPS Only Service Management & Debug Fixes 🎉

This commit is contained in:
2025-06-10 12:54:36 +02:00
parent 9811b6c805
commit c42eb80e8f
4 changed files with 203 additions and 454 deletions

View File

@@ -1,9 +1,9 @@
[Unit]
Description=MYP Kiosk Browser Autostart (Chromium HTTPS) - Wartungsfreier Produktionsbetrieb
Documentation=https://github.com/MYP-Druckerverwaltung
After=graphical-session.target myp-production.service network-online.target
Wants=myp-production.service network-online.target
Requires=graphical-session.target
After=graphical.target myp-production.service network-online.target
Wants=myp-production.service network-online.target graphical.target
Requires=myp-production.service
StartLimitBurst=5
StartLimitInterval=600
@@ -23,16 +23,33 @@ WorkingDirectory=/home/kiosk
ExecStartPre=/bin/bash -c '\
echo "=== MYP Kiosk-Service startet $(date) ==="; \
\
# Prüfe ob X11 läuft \
for i in {1..30}; do \
# Prüfe ob X11 läuft oder starte es \
if ! DISPLAY=:0 xset q >/dev/null 2>&1; then \
echo "🔧 X11 nicht gefunden - versuche Start..."; \
if command -v startx >/dev/null 2>&1; then \
# Starte X11 im Hintergrund falls möglich \
sudo -u pi startx &disown 2>/dev/null || true; \
sleep 5; \
fi; \
fi; \
\
# Warte auf X11 Display \
for i in {1..15}; do \
if DISPLAY=:0 xset q >/dev/null 2>&1; then \
echo "✅ X11 Display verfügbar"; \
break; \
fi; \
echo "⏳ Warte auf X11 Display... ($i/30)"; \
echo "⏳ Warte auf X11 Display... ($i/15)"; \
sleep 2; \
done; \
\
# Falls X11 nicht verfügbar - Headless-Modus \
if ! DISPLAY=:0 xset q >/dev/null 2>&1; then \
echo "⚠️ X11 nicht verfügbar - Kiosk-Modus wird übersprungen"; \
echo "💡 Für grafischen Kiosk: sudo systemctl set-default graphical.target"; \
exit 0; \
fi; \
\
# Warte auf HTTPS-Backend (Port 443) \
echo "🔍 Warte auf HTTPS Backend (Port 443)..."; \
for i in {1..120}; do \