Skip to content

Instantly share code, notes, and snippets.

@classilla
Created February 10, 2020 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save classilla/8eca8881683f3547369b55990cee4166 to your computer and use it in GitHub Desktop.
Save classilla/8eca8881683f3547369b55990cee4166 to your computer and use it in GitHub Desktop.
BitBar and Argos-compatible shell script for getting system fan information over IPMI.
#!/usr/bin/env bash
IPMITOOL=/usr/bin/ipmitool
AWK=/usr/bin/awk
output=`$IPMITOOL sdr type fan | $AWK '{if($5=="ok")print $9}'`
echo -n $output | $AWK 'BEGIN{RS=" ";k=0} {if($1>k)k=$1} END{print k"rpm"}'
echo "---"
echo -n $output | $AWK 'BEGIN{RS=" ";ORS="rpm\n"} {if($1>0)print}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment