fix(@scripts/session-tools): 🐛 improve nvme temp parsing and systemctl output
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
95b3b65196
commit
f11e820d86
1 changed files with 8 additions and 2 deletions
|
|
@ -88,8 +88,12 @@ cmd_check() {
|
|||
echo "NVMe composite temps:"
|
||||
for dev in /dev/nvme?n1; do
|
||||
[ -e "$dev" ] || continue
|
||||
# Match exactly the "temperature" line (not "temperature_sensor_*"),
|
||||
# then take the first integer after the colon.
|
||||
t=$(sudo -n nvme smart-log "$dev" 2>/dev/null \
|
||||
| awk -F: '/^temperature/ {gsub(/[^0-9.]/,"",$2); print $2; exit}')
|
||||
| grep -E '^temperature[[:space:]]*:' \
|
||||
| head -1 \
|
||||
| sed -E 's/.*:[[:space:]]*([0-9]+).*/\1/')
|
||||
printf ' %s %s°C\n' "$dev" "${t:-?}"
|
||||
done
|
||||
fi
|
||||
|
|
@ -116,7 +120,9 @@ cmd_check() {
|
|||
ok "no failed units"
|
||||
else
|
||||
warn "$failed_count failed unit(s):"
|
||||
systemctl --failed --no-pager --no-legend | awk '{print " " $1}'
|
||||
# --no-legend output: "● unit-name loaded failed failed Description"
|
||||
# The first column is the bullet glyph; the unit name is $2.
|
||||
systemctl --failed --no-pager --no-legend | awk '{print " " $2}'
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue