summaryrefslogtreecommitdiff
path: root/check_services.sh
diff options
context:
space:
mode:
Diffstat (limited to 'check_services.sh')
-rwxr-xr-xcheck_services.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/check_services.sh b/check_services.sh
new file mode 100755
index 0000000..3d32937
--- /dev/null
+++ b/check_services.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# check_services.sh – outputs JSON for frontend status page
+
+check_ping() {
+ ping -c1 -W1 "$1" >/dev/null 2>&1 && echo "online" || echo "offline"
+}
+
+check_tcp() {
+ nc -z -w 2 "$1" "$2" >/dev/null 2>&1 && echo "online" || echo "offline"
+}
+
+TEAMTALK_STATUS=$(check_tcp tt.themediahub.org 10442)
+DA_STATUS=$(check_tcp da.genesishostingtechnologies.com 2222)
+SHREDDER_STATUS=$(check_ping shredder.sshjunkie.com)
+
+cat <<EOF
+{
+ "teamtalk": "$TEAMTALK_STATUS",
+ "directadmin": "$DA_STATUS",
+ "shredder": "$SHREDDER_STATUS"
+}
+EOF