#!/data/data/com.termux/files/usr/bin/bash # Stop all Android Agent Runtime services HOME="/data/data/com.termux/files/home" BASE="$HOME/.hermes/event_bus" stop_service() { local name="$1" local pid_file="$2" local as_root="$3" if [ -f "$pid_file" ]; then local pid pid=$(cat "$pid_file") local probe="kill -0 $pid" kill_cmd="kill $pid" [ "$as_root" = "root" ] && probe="su -c '$probe'" && kill_cmd="su -c '$kill_cmd'" if eval "$probe" 2>/dev/null; then eval "$kill_cmd" && echo "[-] $name stopped (pid $pid)" else echo "[-] $name not running" fi rm -f "$pid_file" else echo "[-] $name: no pid file" fi } stop_service "EventServer" "$BASE/event_server.pid" stop_service "NotificationMonitor" "$BASE/notification_monitor.pid" stop_service "MitmProxy" "$BASE/mitm_proxy.pid" root echo "Done."