Repository Public
1#!/bin/bash2# Agent OS — stop the local dev stack started by scripts/dev-up.sh. The database (agent_os_dev) and3# the data dir are left in place. Running missions stay `running`: the next worker resumes them once4# the lease expires (≤ 90 s).5#6# scripts/dev-down.sh stop server + worker (SIGTERM, then SIGKILL after 20 s)7# scripts/dev-down.sh --worker stop only the worker8set -uo pipefail910DATA_DIR="${AOS_DEV_DATA_DIR:-/tmp/aos-dev-data}"11RUN_DIR="$DATA_DIR/run"12TARGETS="server worker"13[ "${1:-}" = "--worker" ] && TARGETS="worker"1415for name in $TARGETS; do16 f="$RUN_DIR/$name.pid"17 [ -f "$f" ] || { echo "$name: not running"; continue; }18 pid="$(cat "$f")"19 if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then20 kill -TERM "$pid" 2>/dev/null21 for _ in $(seq 1 40); do22 kill -0 "$pid" 2>/dev/null || break23 sleep 0.524 done25 if kill -0 "$pid" 2>/dev/null; then26 kill -KILL "$pid" 2>/dev/null27 echo "$name: killed (pid $pid)"28 else29 echo "$name: stopped (pid $pid)"30 fi31 else32 echo "$name: not running"33 fi34 rm -f "$f"35done36