Files
agents_and_robots/dev-scripts/stop.sh
T
egutierrez bd8e1432e5 feat: add assistant bot with LLM integration and configuration
- Implemented the assistant bot with basic command handling and LLM routing.
- Created configuration file for the assistant bot with personality, behavior, and LLM settings.
- Added system prompt for the assistant bot to define its capabilities and limitations.
- Developed registration script for creating Matrix bot users via Synapse admin API.
- Introduced common development scripts for agent management (start, stop, list, logs).
- Scaffolded new agent creation script to streamline the addition of new agents.
- Implemented agent removal script to disable agents without deleting data.
2026-03-03 23:57:13 +00:00

46 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# stop.sh — detiene uno o todos los agentes en ejecución
#
# Uso:
# ./dev-scripts/stop.sh # detiene todos los que estén corriendo
# ./dev-scripts/stop.sh assistant-bot # detiene uno específico
source "$(dirname "$0")/_common.sh"
TARGET="${1:-}"
stopped=0
while IFS='|' read -r id _version _enabled _desc _cfg; do
[[ -n "$TARGET" && "$id" != "$TARGET" ]] && continue
if ! is_running "$id"; then
dim " $id (no está corriendo)"
continue
fi
local_pid="$(read_pid "$id")"
kill -TERM "$local_pid" 2>/dev/null || true
# Espera hasta 5s a que muera limpiamente
for _ in {1..10}; do
kill -0 "$local_pid" 2>/dev/null || break
sleep 0.5
done
# SIGKILL si todavía sigue vivo
if kill -0 "$local_pid" 2>/dev/null; then
warn "$id no respondió a SIGTERM, enviando SIGKILL..."
kill -9 "$local_pid" 2>/dev/null || true
fi
rm -f "$(pid_file "$id")"
ok "$id detenido (PID $local_pid)"
((stopped++)) || true
done < <(list_agents_raw)
[[ "$stopped" -eq 0 && -z "$TARGET" ]] && dim "Ningún agente estaba corriendo."
[[ -n "$TARGET" && "$stopped" -eq 0 ]] && fail "Agente '$TARGET' no encontrado o no estaba corriendo."
true