- Remove unused now_secs(), parse_json_response, any_alive, Regex import - Signal handler: replace Mutex with AtomicPtr<c_char> for signal safety (Mutex::lock in a signal handler can deadlock if main thread holds it) - PidGuard Drop reclaims the leaked CString; signal handler just unlinks - scan_pid_files moved to knowledge.rs as pub helper - setup_agent_state calls scan_pid_files to clean stale pids on startup Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
14 lines
257 B
Bash
Executable file
14 lines
257 B
Bash
Executable file
#!/bin/bash
|
|
# Bail if other agents are alive in the state dir.
|
|
# $1 = path to this agent's pid file
|
|
# cwd = state dir
|
|
#
|
|
# Exit 0 = continue, exit 1 = bail
|
|
|
|
my_pid_file=$(basename "$1")
|
|
|
|
for f in pid-*; do
|
|
[[ $f != $my_pid_file ]] && exit 1
|
|
done
|
|
|
|
exit 0
|