-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdev-stop.sh
More file actions
executable file
·50 lines (42 loc) · 1.26 KB
/
dev-stop.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Stop all L4 development services started by dev-start.sh
set -euo pipefail
PIDFILE="${JL4_PIDFILE:-/tmp/jl4-dev.pid}"
if [ ! -f "$PIDFILE" ]; then
echo "No PID file found at $PIDFILE"
echo "Services may not be running, or were started manually."
exit 1
fi
echo "Stopping L4 development services..."
echo
# Read PIDs from file and kill processes
while IFS='=' read -r name pid; do
if [ -n "$pid" ]; then
if ps -p "$pid" > /dev/null 2>&1; then
echo "Stopping $name (PID $pid)..."
kill "$pid" 2>/dev/null || true
# Wait up to 5 seconds for graceful shutdown
for i in {1..10}; do
if ! ps -p "$pid" > /dev/null 2>&1; then
break
fi
sleep 0.5
done
# Force kill if still running
if ps -p "$pid" > /dev/null 2>&1; then
echo " Force killing $name..."
kill -9 "$pid" 2>/dev/null || true
fi
else
echo "Process $name (PID $pid) not running"
fi
fi
done < "$PIDFILE"
# Clean up PID file
rm -f "$PIDFILE"
# Clean up log files
echo
echo "Cleaning up log files..."
rm -f /tmp/jl4-*.log
echo
echo "✓ All services stopped"