feat: Update 7 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 35s
Build-Test-Publish / build (linux/arm64) (push) Successful in 3m15s

This commit is contained in:
j
2026-01-02 22:27:40 +13:00
parent 767692160d
commit ae5a6fabe9
7 changed files with 95 additions and 2 deletions

View File

@@ -3,10 +3,12 @@ set -uo pipefail
# all_status.sh - Get status and ports for all services on this server
#
# Usage: all_status.sh
# Usage: all_status.sh [EXPECTED_AGENT_HASH]
#
# Output: JSON object with status and ports for each service
# {
# "agent_hash": "hash-of-remote-agent",
# "agent_match": true|false,
# "services": [
# {
# "name": "service-name",
@@ -24,6 +26,17 @@ DROPSHELL_DIR="$(dirname "${AGENT_PATH}")"
SERVICES_DIR="${DROPSHELL_DIR}/services"
# -- Get agent hash --
EXPECTED_HASH="${1:-}"
LOCAL_HASH=""
AGENT_MATCH="true"
if [[ -f "${AGENT_PATH}/agent.hash" ]]; then
LOCAL_HASH=$(cat "${AGENT_PATH}/agent.hash" | tr -d '[:space:]')
fi
if [[ -n "${EXPECTED_HASH}" && "${LOCAL_HASH}" != "${EXPECTED_HASH}" ]]; then
AGENT_MATCH="false"
fi
# -- Helper to escape JSON strings --
json_escape() {
local str="$1"
@@ -37,7 +50,11 @@ json_escape() {
}
# -- Start JSON output --
echo -n '{"services":['
echo -n '{"agent_hash":"'
json_escape "$LOCAL_HASH"
echo -n '","agent_match":'
echo -n "$AGENT_MATCH"
echo -n ',"services":['
first=true