Skip to content

Commit

Permalink
clean up process using ports
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Sep 21, 2024
1 parent e3d0699 commit dd4a712
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/nodes/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -euo pipefail
#set -euo pipefail
export SHELLOPTS
export RUST_BACKTRACE=full RUST_LOG=info,fnn=debug

Expand Down Expand Up @@ -39,7 +39,25 @@ if [[ -f "$deploy_dir/.env.local" ]]; then
fi

echo "Initializing finished, begin to start services ...."
sleep 1

clean_up() {
PORTS=(8344 8345 8346 41713 41714 41715 41716 8114)

for PORT in "${PORTS[@]}"; do
PIDS=$(lsof -t -i:$PORT || true)
# Check if there are any PIDs to kill
if [ -n "$PIDS" ]; then
echo "Killing processes using port $PORT: $PIDS"
# Kill the processes
kill -9 $PIDS
else
echo "No processes found using port $PORT."
fi
done
}

clean_up
sleep 3

ckb run -C "$deploy_dir/node-data" --indexer &

Expand Down

0 comments on commit dd4a712

Please sign in to comment.