#!/bin/bash # machinotero - store description of computer hardware and configuration # usage: sudo machinotero # (c) 2007 Tero Karvinen www.iki.fi/karvinen function r # r - run command, return stderr and stdout { CMD=$*; echo -n "$CMD; "; echo -e "\n=== $CMD ===" >> $OUT; $CMD >> $OUT 2>&1; } function sec # add section heading { echo -e "\n== $1 ==" >> $OUT; } ### main STARTED=$(date +"%Y-%m-%d_%H%M") HOST=$(hostname) HOST=$(echo -n $HOST|tr -c "[a-z0-9]" "_") if [ -z $1 ]; then OUT=$HOST-$STARTED.txt; else OUT=$1; fi # Erase old file (same minute) if it exists. echo "$HOST $STARTED" > $OUT; if (( 0 != $(id -u) )); then echo "Warning: You are not root. Information will be incomplete. " echo "Try: sudo $(basename $0)" echo "Run as non-root, incomplete information. " >> $OUT fi echo "Machinotero http://www.iki.fi/karvinen/machinotero" >> $OUT; echo "Jump to next section by searching for \"== \"." >> $OUT; sec Overview r uname -a r cat /etc/lsb-release r 'cat /var/lib/acpi-support/*-*' r free -m r df -h r lshw sec Network r ifconfig r iwconfig r ip link r ip addr r ip route r ip rule r ip neigh r ip tunnel r ip maddr r ip mroute # not: ip monitor; ip xfrm sec Software r dpkg --list linux-image* xserver-xorg hal r cat /etc/apt/sources.list r cat /etc/apt/sources.list.d/* r dpkg --list xresprobe dmidecode lshw vbetool smartmontools r tail /var/log/apache/error.log r tail /var/log/apache2/error.log sec Specific hardware and drivers r lsmod r fdisk -l r smartctl -a /dev/hda r smartctl -a /dev/hdb r smartctl -a /dev/hdc r smartctl -a /dev/hdd r smartctl -a /dev/sda r smartctl -a /dev/sdb r smartctl -a /dev/sdc r smartctl -a /dev/sdd r dmidecode r lspci r lspci -n r lspci -v r lsusb sec Display and X r ddcprobe # switches to non-X virtual term and back: r xresprobe nv r vbetool vbefp panelsize sec Long Logs, Config Files and Outputs r dmesg | head -25 r dmesg | tail -25 r head -25 /var/log/syslog r tail -25 /var/log/syslog r cat /etc/X11/xorg.conf r cat /var/log/Xorg.0.log r lsusb -v r dpkg --list *driver* *usb* *grub* *firefox* *thunderbird*|grep -v ^un echo -e "\nDone. " # netstat -pea -n --inet|grep LISTEN # iptables -L