Inventory/dumpscript

From UGCS
Jump to: navigation, search
#!/bin/sh

#dump.sh
#Basic script to wiki-ify lspci and df and other useful diagnostics

if [ -x /usr/bin/lspci ]; then
  LSPCI="/usr/bin/lspci";
elif [ -x /sbin/lspci ]; then
  LSPCI="/sbin/lspci";
elif [ -x ./lspci && -f ./pci.ids ]; then
  LSPCI="./lspci -i ./pci.ids";
fi

echo "|-"
echo "| `/sbin/ifconfig | grep 'inet ' | grep -v '127.0.0.1' | awk '{print(substr($2,18))}'`"
echo "| `hostname`"
echo "| Yes"
echo "| "
grep 'model name\|MHz' /proc/cpuinfo |
    sed -e 's/\([A-Z]\)/%\1/' -e 's/.*: //' |
    xargs echo | sed -e 's/%/\n* /g'| sed -e '/^$/d'
echo "| `free -m | grep Mem | awk '{print($2"MB")}'`"
echo "| "
$LSPCI | grep -i -v 'bridge\|smbus' | sed -e 's/^[a-zA-Z0-9:\.]* //g' \
                 -e 's/^/* /g' \
                 -e 's/ (rev [0-9a-zA-Z]*)$//g'
echo "| "
df -h | grep '^/dev' | awk '{print($1, $3"/"$2, $5, $6)}' | sed -e 's/^/* /'
echo "| "
Personal tools