#!/usr/bin/env bash # Start Konduktor for hands-on testing, protecting what actually needs it. # # Clicking around the real app means clicking real Save buttons, so the TRAKTOR # collection is copied into a throwaway sandbox — it is 8,485 entries of real, # irreplaceable library. The REKORDBOX library is opened live, because it is a # disposable test library kept for exactly this. # # Prefs and version history always go to a temp directory, so testing never # disturbs the real ones. Ctrl-C stops both servers. # # Override either source with KONDUKTOR_TRAKTOR_SRC / KONDUKTOR_REKORDBOX_SRC, # or set KONDUKTOR_COPY_REKORDBOX=1 to sandbox Rekordbox too. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Refuse to start if something is already SERVING on the ports. # # This is load-bearing, not a nicety: if :8000 is taken, this script's backend # dies quietly and the browser talks to whatever was already there — quite # possibly a server holding the real Traktor collection. The window would still # claim to be a sandbox while every Save went somewhere else entirely. # # `-sTCP:LISTEN` matters: a plain `lsof -ti:PORT` also matches CLIENT sockets, so # a browser tab left open on the old app looks exactly like a running server and # blocks startup for no reason. for port_and_what in "8000:backend" "5173:frontend"; do port="${port_and_what%%:*}" what="${port_and_what##*:}" if lsof -ti:"$port" -sTCP:LISTEN >/dev/null 2>&1; then cat >&2 </dev/null || true' EXIT INT TERM cat <