From a793e910b5e819ed68a674cd7814e789e0d7130f Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 28 Nov 2025 10:44:36 +0100 Subject: [PATCH] Update fix_wt_config.sh to improve configuration execution by ensuring it is executable and properly set up for use. --- fix_global_wt_config.sh | 45 +++++++++++++++++++++++++++++++++++ test_progressive_bootstrap.sh | 38 +++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100755 fix_global_wt_config.sh create mode 100755 test_progressive_bootstrap.sh diff --git a/fix_global_wt_config.sh b/fix_global_wt_config.sh new file mode 100755 index 0000000..e5c17cf --- /dev/null +++ b/fix_global_wt_config.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Skript zum Hinzufügen von head-matter in /etc/wt/wt_config.xml +# für application-settings, damit es auch für Bot-Sessions gilt + +CONFIG_FILE="/etc/wt/wt_config.xml" +BACKUP_FILE="${CONFIG_FILE}.backup.$(date +%Y%m%d_%H%M%S)" + +echo "=== Backup erstellen ===" +sudo cp "$CONFIG_FILE" "$BACKUP_FILE" +echo "Backup erstellt: $BACKUP_FILE" + +echo -e "\n=== Prüfe, ob head-matter bereits existiert ===" +if sudo grep -q "" "$CONFIG_FILE"; then + echo "WARNUNG: existiert bereits in $CONFIG_FILE!" + sudo grep -n "" "$CONFIG_FILE" + exit 1 +fi + +echo -e "\n=== Füge head-matter in application-settings ein ===" +# Finde die application-settings location="*" Sektion und füge head-matter hinzu +# Vor dem schließenden Tag +sudo sed -i '//,/<\/application-settings>/ { + /<\/application-settings>/i\ + \ + \ + \ + +}' "$CONFIG_FILE" + +echo -e "\n=== Geänderte Konfiguration anzeigen ===" +sudo grep -A 3 -B 3 "head-matter" "$CONFIG_FILE" + +echo -e "\n=== Service neu starten ===" +sudo systemctl restart ypchat.service +sleep 3 + +echo -e "\n=== Service-Status ===" +sudo systemctl status ypchat.service --no-pager | grep -E "Active|since" | head -2 + +echo -e "\n=== Test mit Googlebot ===" +curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" \ + https://www.ypchat.net/ | grep -i "meta.*robots" | head -1 + +echo -e "\n=== Fertig! ===" + diff --git a/test_progressive_bootstrap.sh b/test_progressive_bootstrap.sh new file mode 100755 index 0000000..736151c --- /dev/null +++ b/test_progressive_bootstrap.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Test: Setze progressive-bootstrap auf false, damit Bot-Sessions auch die App starten + +CONFIG_FILE="/etc/wt/wt_config.xml" +BACKUP_FILE="${CONFIG_FILE}.backup.$(date +%Y%m%d_%H%M%S)" + +echo "=== Backup erstellen ===" +sudo cp "$CONFIG_FILE" "$BACKUP_FILE" +echo "Backup erstellt: $BACKUP_FILE" + +echo -e "\n=== Aktueller progressive-bootstrap Wert ===" +sudo grep -n "progressive-bootstrap" "$CONFIG_FILE" + +echo -e "\n=== Setze progressive-bootstrap auf false ===" +sudo sed -i 's|true|false|' "$CONFIG_FILE" + +echo -e "\n=== Neuer Wert ===" +sudo grep -n "progressive-bootstrap" "$CONFIG_FILE" + +echo -e "\n=== Service neu starten ===" +sudo systemctl restart ypchat.service +sleep 3 + +echo -e "\n=== Service-Status ===" +sudo systemctl status ypchat.service --no-pager | grep -E "Active|since" | head -2 + +echo -e "\n=== Test mit Googlebot ===" +curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" \ + https://www.ypchat.net/ | grep -i "meta.*robots" | head -1 + +echo -e "\n=== Prüfe, ob App-Inhalte vorhanden sind ===" +curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" \ + https://www.ypchat.net/ | grep -i "yp direct\|chat starten" | head -1 + +echo -e "\n=== Fertig! ===" +echo "Hinweis: Wenn das nicht funktioniert, kann mit dem Backup wiederhergestellt werden:" +echo "sudo cp $BACKUP_FILE $CONFIG_FILE" +