All checks were successful
Update Dispatches / refresh-news (push) Successful in 3s
43 lines
1.6 KiB
Bash
43 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# -----------------------------------------------------------------------
|
|
# Dynasty Module: Universal Pulse (Unified system-info)
|
|
# -----------------------------------------------------------------------
|
|
|
|
# --- 1. OS Detection ---
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
OS="macOS"
|
|
# Mac specific: using sysctl and native uptime
|
|
CPU_LOAD=$(sysctl -n vm.loadavg | awk '{print $2}')
|
|
MEM_TOTAL=$(sysctl -n hw.memsize)
|
|
MEM_TOTAL_GB=$((MEM_TOTAL / 1024 / 1024 / 1024))
|
|
UPTIME=$(uptime | sed -E 's/.*up ([^,]+),.*/\1/' | xargs)
|
|
DISK=$(df -h / | awk 'NR==2 {print $5}')
|
|
else
|
|
OS="Linux"
|
|
# Linux specific: using free and top
|
|
CPU_LOAD=$(top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4}')"%"
|
|
MEM_TOTAL_GB=$(free -g | awk '/^Mem:/{print $2}')
|
|
UPTIME=$(uptime -p | sed 's/up //')
|
|
DISK=$(df -h / | awk 'NR==2 {print $5}')
|
|
fi
|
|
|
|
# --- 2. Build the Dashboard ---
|
|
DASHBOARD="
|
|
🐉 DYNASTY SYSTEM PULSE ($OS)
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
🕒 UPTIME: $UPTIME
|
|
🚀 CPU LOAD: $CPU_LOAD
|
|
🧠 MEMORY: ${MEM_TOTAL_GB}GB Total
|
|
💾 DISK: $DISK Used
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
"
|
|
|
|
# --- 3. Manifest ---
|
|
# If whiptail isn't on the Mac yet, it will print clean text instead.
|
|
if command -v whiptail >/dev/null 2>&1; then
|
|
whiptail --title "Dynasty Diagnostics" --msgbox "$DASHBOARD" 15 50
|
|
else
|
|
clear
|
|
echo -e "$DASHBOARD"
|
|
read -p "Press Enter to return to Dynasty..." < /dev/tty
|
|
fi |