From ad2a10b1c71f648b78ccc8b8d62f57bf9058e81e Mon Sep 17 00:00:00 2001 From: sanj <67624670+iodrift@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:07:59 -0700 Subject: [PATCH] Auto-update: Tue Aug 6 15:07:59 PDT 2024 --- vitals | 74 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/vitals b/vitals index 364949b..835e1c6 100755 --- a/vitals +++ b/vitals @@ -6,7 +6,16 @@ adguard_home_ip='100.64.64.15' if [[ "$(uname)" == "Darwin" ]]; then # macOS local_ip=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | head -n1) - uptime=$(uptime | awk '{print $3}' | sed 's/,//') + uptime_seconds=$(sysctl -n kern.boottime | awk '{print $4}' | sed 's/,//') + current_time=$(date +%s) + uptime_seconds=$((current_time - uptime_seconds)) + days=$((uptime_seconds / 86400)) + hours=$(( (uptime_seconds % 86400) / 3600 )) + minutes=$(( (uptime_seconds % 3600) / 60 )) + uptime="up " + [[ $days -gt 0 ]] && uptime+="$days days, " + [[ $hours -gt 0 ]] && uptime+="$hours hours, " + uptime+="$minutes minutes" else # Linux local_ip=$(hostname -I | awk '{print $1}') @@ -22,8 +31,11 @@ if [ ! -z "$wan_info" ]; then blacklisted=$(echo "$wan_info" | jq '.blacklisted.blacklisted') else wan_ip="Unavailable" + mullvad_exit_ip=false + blacklisted=false fi + # Check if Tailscale is installed and get IP if command -v tailscale &> /dev/null; then has_tailscale=true @@ -33,8 +45,8 @@ if command -v tailscale &> /dev/null; then # Parse exit node hostname if echo "$ts_exitnode_output" | grep -q 'selected'; then mullvad_exitnode=true - # Extract the hostname of the selected exit node - mullvad_hostname=$(echo "$ts_exitnode_output" | grep 'selected' | awk '{print $2}') + # Extract the hostname of the selected exit node, remove any newline characters, and take only the first occurrence + mullvad_hostname=$(echo "$ts_exitnode_output" | grep 'selected' | awk '{print $2}' | tr -d '\n' | awk -F'.' '{print $1"."$2"."$3"."$4}') else mullvad_exitnode=false mullvad_hostname="" @@ -77,24 +89,40 @@ else adguard_client="" fi -cat <