#!/usr/bin/env bash # Desktop-launcher entry point: starts the backend (if not already running) # and opens the browser once it's actually accepting requests, instead of a # blind sleep. set -euo pipefail URL="http://localhost:8000" LOG="/home/gardentech/scan_web_logs/server.log" mkdir -p "$(dirname "$LOG")" if ! curl -sf "$URL/api/status" >/dev/null 2>&1; then nohup /home/gardentech/scan_web/run_scan_web.sh >>"$LOG" 2>&1 & for _ in $(seq 1 60); do if curl -sf "$URL/api/status" >/dev/null 2>&1; then break fi sleep 0.5 done fi xdg-open "$URL" >/dev/null 2>&1 &