From f0fbaa2774ee31c4690226aca33645692247a842 Mon Sep 17 00:00:00 2001 From: Iam54r1n4 Date: Fri, 7 Feb 2025 18:26:45 +0000 Subject: [PATCH] Add status.sh script to get status of project services --- core/scripts/status.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 core/scripts/status.sh diff --git a/core/scripts/status.sh b/core/scripts/status.sh new file mode 100644 index 0000000..eaf42fb --- /dev/null +++ b/core/scripts/status.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +declare -a services=( + "hysteria-server.service" + "webpanel.service" + "hysteria-bot.service" + "normalsub.service" + "singbox.service" + "wg-quick@wgcf.service" +) + +status_json="{" +for service in "${services[@]}"; do + if systemctl is-active --quiet "$service"; then + status_json+="\"$service\":true," + else + status_json+="\"$service\":false," + fi +done + +# Remove trailing comma and close JSON properly +status_json="${status_json%,}}" + +# Format output as valid JSON +echo "$status_json" | jq -M .