From 55a2de04ca40ba5e079caa68034ecadc517e02fb Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 19 Jun 2026 10:42:56 +0200 Subject: [PATCH] =?UTF-8?q?Autostart-Script=20f=C3=BCr=20Flask=20+=20Cloud?= =?UTF-8?q?flare=20Tunnel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start-tunnel.sh | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/start-tunnel.sh b/start-tunnel.sh index 5a46d67..4ae3507 100755 --- a/start-tunnel.sh +++ b/start-tunnel.sh @@ -1,24 +1,22 @@ #!/bin/bash -# Start permanent Cloudflare Tunnel for BSN Chatbot -# Usage: bash start-tunnel.sh +# BSN Chatbot Autostart +# Flask App + Cloudflare Tunnel -set -e +cd /home/hermes/workspace/bsn-chatbot -TOKEN="$1" -if [ -z "$TOKEN" ]; then - echo "Usage: bash start-tunnel.sh " - exit 1 -fi +# Flask App +echo "Starting Flask..." +/home/hermes/venv/bin/python app.py & +FLASK_PID=$! +sleep 2 -# Save token -echo "$TOKEN" > /home/hermes/workspace/bsn-chatbot/.cloudflare_token -chmod 600 /home/hermes/workspace/bsn-chatbot/.cloudflare_token -echo "Token saved ($(wc -c < /home/hermes/workspace/bsn-chatbot/.cloudflare_token) chars)" +# Cloudflare Tunnel +echo "Starting Cloudflare Tunnel..." +cloudflared tunnel --origincert /home/hermes/workspace/bsn-chatbot/cert.pem run bsn-chat & +TUNNEL_PID=$! -# Kill any existing cloudflared -pkill -9 -f cloudflared 2>/dev/null || true -sleep 1 +echo "Flask PID: $FLASK_PID" +echo "Tunnel PID: $TUNNEL_PID" +echo "chat.datenhimmel.work sollte in ~15s erreichbar sein" -# Start permanent tunnel -echo "Starting tunnel..." -exec /home/hermes/.local/bin/cloudflared tunnel run --token "$TOKEN" \ No newline at end of file +wait