Files
dark-lord/scripts/start-onion-if-needed.sh
drjones 04d64fb993 Update market, account, and onion operations
Capture the current CyberLux UI, commerce, messaging, and Tor ops updates so local main can be pushed to the remote.

Made-with: Cursor
2026-04-24 23:23:48 -07:00

20 lines
558 B
Bash
Executable File

#!/usr/bin/env bash
# Start CyberLux onion backend if 127.0.0.1:3000 is not already occupied.
# Used by the user systemd unit and @reboot cron fallback.
set -euo pipefail
REPO="/home/drjones/cyberlux"
LOG="${REPO}/logs/onion-runtime.log"
mkdir -p "${REPO}/logs"
if command -v ss >/dev/null 2>&1 && ss -ltn 'sport = :3000' | grep -q '127.0.0.1:3000'; then
echo "$(date -Is) cyberlux already listening on 127.0.0.1:3000" >>"${LOG}"
exit 0
fi
cd "${REPO}"
node scripts/generate-onion-config.cjs >>"${LOG}" 2>&1
exec npm run start:onion >>"${LOG}" 2>&1