Listing 1. The Collect Shell Script
#!/bin/bash
# This script collects files from /proc for the
# named Linux system and puts them into a
# subdirectory under the current directory.
# It also picks up the following files:
# /usr/src/linux/.config (which is copied
# to "kernel.config")
# /etc/lilo.conf
# and does the following remote tasks:
# fdisk -l (copied to file "fdisk")
#
if [ "$1" = "" ]
then
echo "System name missing"
echo " "
echo "Usage: $0 Linux_system_name"
exit
fi
#
# If the directory doesn't exist, create it. If a
# file exists, but isn't a directory, complain and
# exit.
if [ ! -e $1 ]; then
mkdir $1
else
if [ ! -d $1 ]; then
echo "$1 must be a directory."
echo "Delete $1 and rerun $0"
exit
fi
fi
cd $1
#
# Copy the files named below from the remote's
# /proc to the current directory.
echo -n "Copying /proc, "
for i in cpuinfo devices dma filesystems\
interrupts ioports meminfo mounts version
do
rsh $1 cat /proc/$i >$i
done
#
# Get the kernel build info; copy it to
# "kernel.config".
echo -n ".config, "
rcp -p $1:/usr/src/linux/.config kernel.config
#
# Get the LILO configuration file.
echo -n "lilo.conf, "
rcp -p $1:/etc/lilo.conf .
#
# Get the fdisk info (the number and size of
# partitions).
echo "partition info"
rsh $1 "/sbin/fdisk -l" >fdisk
Copyright © 1994 - 2018 Linux Journal. All rights reserved.