auto-save 2026-05-15 11:18 (+1, ~4)
This commit is contained in:
26
scripts/stop-dev-background.sh
Executable file
26
scripts/stop-dev-background.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
PID_DIR="$ROOT_DIR/.pids"
|
||||
|
||||
stop_pid_file() {
|
||||
local name="$1"
|
||||
local file="$PID_DIR/$name.pid"
|
||||
if [[ ! -f "$file" ]]; then
|
||||
echo "$name pid file not found"
|
||||
return
|
||||
fi
|
||||
local pid
|
||||
pid="$(cat "$file")"
|
||||
if [[ -n "$pid" ]] && kill -0 "$pid" >/dev/null 2>&1; then
|
||||
kill -TERM "$pid"
|
||||
echo "$name stopped: $pid"
|
||||
else
|
||||
echo "$name already stopped"
|
||||
fi
|
||||
rm -f "$file"
|
||||
}
|
||||
|
||||
stop_pid_file api
|
||||
stop_pid_file web
|
||||
Reference in New Issue
Block a user