File size: 426 Bytes
85d769f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

# Kill any process bound to port 3004 so the nova-sim server can be restarted cleanly.
set -euo pipefail

if ! command -v lsof >/dev/null 2>&1; then
    echo "lsof is required but missing" >&2
    exit 1
fi

PIDS=$(lsof -ti tcp:3004 2>/dev/null || true)

if [[ -z "$PIDS" ]]; then
    echo "No server listening on port 3004"
    exit 0
fi

echo "Killing nova-sim processes on port 3004: $PIDS"
kill $PIDS