diff --git a/scripts/status.sh b/scripts/status.sh index b64782c..36db030 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -40,10 +40,10 @@ fi echo "" if pm2 describe "$PM2_NAME" >/dev/null 2>&1; then PM2_DESC=$(pm2 describe "$PM2_NAME" 2>/dev/null) - STATUS=$(echo "$PM2_DESC" | grep "status" | head -1 | sed 's/.*│ *//' | sed 's/ *│.*//') - PID=$(echo "$PM2_DESC" | grep -E "^\\│ pid " | head -1 | sed 's/.*│ *//' | sed 's/ *│.*//') - UPTIME=$(echo "$PM2_DESC" | grep "uptime" | head -1 | sed 's/.*│ *//' | sed 's/ *│.*//') - RESTARTS=$(echo "$PM2_DESC" | grep "restarts" | head -1 | sed 's/.*│ *//' | sed 's/ *│.*//') + STATUS=$(echo "$PM2_DESC" | grep "status" | head -1 | perl -pe 's/.*?\s+(\S+)\s*$/\1/') + PID=$(echo "$PM2_DESC" | grep -E "pid " | head -1 | perl -pe 's/.*?\s+(\d+)\s*$/\1/') + UPTIME=$(echo "$PM2_DESC" | grep "uptime" | head -1 | perl -pe 's/^.*\x{2502}\s*//; s/\s*$//') + RESTARTS=$(echo "$PM2_DESC" | grep "restarts" | head -1 | perl -pe 's/^.*\x{2502}\s*//; s/\s*$//') if [ "$STATUS" = "online" ]; then echo " PM2: online ✅"