Files
Unified_Dashboard_Suite_Go/launch_dashboard_go.fish
T

37 lines
997 B
Fish
Executable File

#!/usr/bin/env fish
# --- Configuration ---
# Automatically resolve repository directory if executed from within the repo
set -l SCRIPT_DIR (cd (dirname (status filename)); and pwd)
if test -f "$SCRIPT_DIR/configs/tools.yaml"
set -q GO_SUITE_PATH; or set GO_SUITE_PATH "$SCRIPT_DIR"
else
set -q GO_SUITE_PATH; or set GO_SUITE_PATH "/home/creserver/Desktop/Vaishno_workspace/Unified_Dashboard_Suite_Go"
end
set GATEWAY_BIN "$GO_SUITE_PATH/bin/nexus-gateway"
set GATEWAY_PORT 10000
set PORTS_TO_CHECK $GATEWAY_PORT 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011
function kill_ports
for PORT in $argv
if type -q lsof
set PID (lsof -t -i:$PORT)
if test -n "$PID"
kill -9 $PID
end
else if type -q fuser
fuser -k -n tcp $PORT > /dev/null 2>&1
end
end
end
# Kill old processes
kill_ports $PORTS_TO_CHECK
cd $GO_SUITE_PATH
# Launch Go Gateway
set -x PORT $GATEWAY_PORT
exec $GATEWAY_BIN