Files
KX-Bridge-Release/bridge.sh
Phil Merricks de1a5df53c fix: cert check on connect, force IPv4, clean up bridge.sh default IP
- Raise FileNotFoundError with clear message when TLS certs are missing
  rather than a cryptic SSL error
- Use getaddrinfo(AF_INET) before create_connection to force IPv4 and
  avoid dual-stack resolution failures on some networks
- Comment out hardcoded PRINTER_IP in bridge.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 17:40:56 +01:00

43 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Bridge-Manager: start | stop | restart | status | log
SCRIPT="$(dirname "$0")/kobrax_moonraker_bridge.py"
LOGFILE="/tmp/bridge.log"
# PRINTER_IP="192.168.178.94"
case "${1:-restart}" in
start)
if ss -tlnp | grep -q 7125; then
echo "Port 7125 belegt beende alte Instanz..."
fuser -k 7125/tcp 2>/dev/null || pkill -f kobrax_moonraker_bridge 2>/dev/null
sleep 1
fi
nohup python3 "$SCRIPT" --printer-ip "$PRINTER_IP" > "$LOGFILE" 2>&1 &
echo "Bridge gestartet PID=$!"
sleep 2; tail -3 "$LOGFILE"
;;
stop)
pkill -f kobrax_moonraker_bridge && echo "Bridge beendet" || echo "Nicht aktiv"
fuser -k 7125/tcp 2>/dev/null
;;
restart)
"$0" stop
sleep 1
"$0" start
;;
status)
if ss -tlnp | grep -q 7125; then
echo "Bridge läuft (Port 7125 aktiv)"
ps aux | grep kobrax_moonraker | grep -v grep
else
echo "Bridge nicht aktiv"
fi
;;
log)
tail -${2:-20} "$LOGFILE"
;;
*)
echo "Usage: $0 {start|stop|restart|status|log [N]}"
exit 1
;;
esac