#!/usr/bin/env bash
# Usage: ./stop-server.sh [scratch-dir]
SCRATCH="${1:-/tmp/run-server-scratch}"
if [ -f "$SCRATCH/server.pid" ]; then
  kill "$(cat "$SCRATCH/server.pid")" 2>/dev/null || true
  rm -f "$SCRATCH/server.pid"
  echo "stopped"
else
  echo "no $SCRATCH/server.pid -- nothing to stop"
fi
