feat: enhance agent management with support for multiple instances and update UI accordingly
This commit is contained in:
+2
-14
@@ -16,14 +16,6 @@ start_agent() {
|
||||
local pid_f; pid_f="$(pid_file "$id")"
|
||||
local bin="$REPO_ROOT/bin/launcher"
|
||||
|
||||
# Check for duplicate instances already running
|
||||
local existing; existing="$(count_instances "$id")"
|
||||
if [[ "$existing" -gt 0 ]]; then
|
||||
warn "$id already has $existing instance(s) running (orphan processes?)"
|
||||
warn " Run ./dev-scripts/stop.sh $id first to clean up"
|
||||
return 1
|
||||
fi
|
||||
|
||||
info "Iniciando $id..."
|
||||
|
||||
# Build the binary first to avoid go run wrapper PID issues
|
||||
@@ -46,7 +38,8 @@ start_agent() {
|
||||
# Espera un momento y verifica que el proceso siga vivo
|
||||
sleep 1
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
ok "$id PID $pid → logs: $log"
|
||||
local inst; inst="$(count_instances "$id")"
|
||||
ok "$id PID $pid (instances: $inst) → logs: $log"
|
||||
else
|
||||
rm -f "$pid_f"
|
||||
fail "$id arrancó pero murió — revisa: tail -f $log"
|
||||
@@ -64,11 +57,6 @@ while IFS='|' read -r id version enabled desc cfg; do
|
||||
continue
|
||||
fi
|
||||
|
||||
if is_running "$id"; then
|
||||
warn "$id (ya corriendo, PID $(read_pid "$id"))"
|
||||
continue
|
||||
fi
|
||||
|
||||
start_agent "$id" "$cfg"
|
||||
((started++)) || true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user