#!/bin/sh # (calls sh, but needs bash) # # sysinfo-collect # # Gather some system information and store in gziped tar file. # # Copyright (C) 2003-2013 by Volker Kuhlmann # http://volker.top.geek.nz/contact.html # All rights reserved. # Released under the terms of the GNU General Public License (GPL) Version 2. # See http://www.gnu.org/ for details. # # Volker Kuhlmann # 23 Jun; 2 Jul 2003 # 14 Jan; 9, 19 Dec 2004 # 12 Feb 2005 updated, renamed from sysinfo to sysinfo-collect # 3, 14 Mar 2006 # 3 Jul 2010 # 1 Jun 2011 Deal with fdisk -lu being default. # 22 Jan 2013 Add output of a few more lsXXX, and from 3 more programs of # the dmidecode package. # # Version 2.2 # # Working directory. wd=/tmp/sysinfo-dir # Files to save from /proc (must be copied first). saveproc=( apm cmdline cpufreq cpuinfo crypto devices dma filesystems ide/drivers ide/ide?/hd?/* ide/piix interrupts iomem ioports isapnp mdstat meminfo misc modules mounts partitions pci scsi/scsi swaps version ) # Files to save (recursively if directory) from /sys (must be copied first). savesys=( class/dmi/id ) set -x unset LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME wd="$wd/sysinfo" mkdir -p "$wd" || exit 9 cd "$wd" || exit 9 fdisk -l >fdisk fdisk -lu >fdisk-u cmp -q fdisk fdisk-u \ && fdisk -u=cylinders -l >fdisk lspci >lspci lspci -n >lspci-n lspci -vv >lspci-vv lsusb >lsusb lsusb -v >lsusb-v lsmod >lsmod if type -p lsscsi >/dev/null; then lsscsi -lvg >lsscsi-lvg lsscsi -g >lsscsi-g else echo "No command lsscsi!" fi for prog in \ lscpu lsdev lshal lsblk \ biosdecode ownership vpddecode dmidecode do if type -p $prog >/dev/null; then $prog >"$prog" else echo "No command $prog!" fi done mount >mount df -k >df free >free uname -a >uname-a setserial -ag /dev/ttyS[0-7] >serial rpm -qa | sort >rpms cp /etc/*release . cp -p /etc/*release . cp "$0" "`basename $0`".sh cp -p "$0" "`basename $0`".sh cd /proc rm -rf "$wd/proc" mkdir -p "$wd/proc" for file in "${saveproc[@]}"; do test -e "$file" || continue test "${file%/*}" != "$file" && mkdir -p "$wd/proc/${file%/*}" cp -p "$file" "$wd/proc/$file" done cd /sys rm -rf "$wd/sys" mkdir -p "$wd/sys" for item in "${savesys[@]}"; do find "$item" "$item/" -type f | while read pathfile; do path="${pathfile%/*}" file="${pathfile##*/}" echo "$path - $file" mkdir -p "$wd/sys/$path" cp -p "$path/$file" "$wd/sys/$path" done done cd "$wd" if type -p hwinfo >/dev/null; then hwinfo >hwinfo else echo "No command hwinfo!" fi cd "$wd/.." export GZIP=-9 tar -czf sysinfo.tar.gz sysinfo echo "System info saved in: `pwd`/sysinfo.tar.gz"