#!/bin/sh # This script gathers a bunch of information about a SUT and stores it # into a given directory structure. if [ $# -lt 2 ]; then echo "Usage: $0 " exit -1 fi file_list=$1 snapshot_dir=$2 if [ ! -d $snapshot_dir ]; then echo "Error: Directory '$snapshot_dir' does not exist!" exit -1 fi if [ ! -w $snapshot_dir ]; then echo "Error: Directory '$snapshot_dir' is not writeable!" exit -1 fi if [ -d INFO ]; then echo "Error: A prior snapshot already exists in '$snapshot_dir'" exit -10 fi for file in `cat $file_list`; do echo $file cp --parents $file tmp/ done cd $snapshot_dir || exit -1 mkdir -p etc boot home mnt root tmp var/log var/run INFO usr/src ps waux > INFO/processes hostname > INFO/hostname domainname > INFO/domainname rpcinfo -p > INFO/rpcinfo exportfs -v > INFO/exportfs lshw > INFO/lshw lspci -vvv > INFO/lspci lsusb > INFO/lsusb lsmod > INFO/lsmod rc-update -s > INFO/services ifconfig > INFO/ifconfig dmesg > INFO/dmesg env > INFO/env df -h > INFO/df uname -a > INFO/uname netstat > INFO/netstat nfsstat > INFO/nfsstat klist > INFO/klist ktutil list > INFO/ktutil showmount > INFO/showmount # TODO: Determine OS we're running under ls -lFR /etc > etc/DIR_LIST ls -lFR /boot > boot/DIR_LIST ls -lFR /mnt > mnt/DIR_LIST ls -lFR /root > root/DIR_LIST ls -lFR /tmp > tmp/DIR_LIST ls -lFR /var/log > var/log/DIR_LIST ls -lFR /var/run > var/run/DIR_LIST ls -lF /usr/src > usr/src/DIR_LIST # TODO: Create a README with a toplevel summary chmod -R u+rw .