Well I coded this out for a friends and was thinking this could help someone els. If you have any quests just ask. It is a simple little script for Linux. I coded it out for Fedora. Anyways, have fun!
Code:
#!/bin/bash
#
# - Sysprofile Script
#
outputfile="Report-[`date '+%b.%d.%H:%M'`].txt"
tempfile=Temp.txt
#==================================================================================
#=========[ Sysinfo - s ]=========================================================
#==================================================================================
if [ "$1" == "-s" -o "$1" == "-a" ]; then
#{
echo "-----------------------------------------------------------------------------"
echo "Hostname: `hostname`"
echo "Kernel: `uname -r`"
echo "Distro: `cat /etc/issue | grep -m 1 ''`"
echo "Runnung: `uptime | awk '{print $3}' | tr -d /,`"
echo "-----------------------------------------------------------------------------"
#}
fi
#==================================================================================
#=========[ sysinfo - h ]=========================================================
#==================================================================================
if [ "$1" == "-h" -o "$1" == "-a" ]; then
#{
echo "-----------------------------------------------------------------------------"
echo "Num CPUs: `cat /proc/cpuinfo | grep -c processor`"
echo "CPU Model: `cat /proc/cpuinfo | grep -m 1 'model name' | cut -d: -f2`"
echo "RAM: `free -m -t | grep 'Mem' | awk '{print $2}'` MB"
echo "Free Ram: `free -m -t | grep 'Mem' | awk '{print $4}'` MB"
echo "Used RAM: `free -m | grep 'Mem' | awk '{print $3}'` MB"
echo "-----------------------------------------------------------------------------"
#}
fi
#==================================================================================
#=========[ sysinfo - n ]=========================================================
#==================================================================================
num=`ip add | grep -c ': '`
count=1
if [ "$1" = "-n" -o "$1" = "-a" ]; then
#{
echo "-----------------------------------------------------------------------------"
until [ "$num" = "$count" ]
do
echo "`ip add | grep -m 1 -A 3 $count:`" > $tempfile
NAME=`cat $tempfile | grep -m 1 $count: | awk '{print $2}'`
IP=`cat $tempfile | grep -m 1 'inet ' | awk '{print$2}'`
MAC=`cat $tempfile | grep -m 1 'link/' | awk '{print $2}'`
if [ "$IP" = "" ]; then
IP="000.000.000.000/0"
echo -e "$NAME `` $IP ``\t`` $MAC"
else
if [ "$IP" = "127.0.0.1/8" ]; then
echo -e "$NAME ``\t`` $IP ``\t````\t`` $MAC"
else
echo -e "$NAME ``\t`` $IP ``\t`` $MAC"
fi
fi
shift
count=`expr $count + 1`
done
echo "-----------------------------------------------------------------------------"
echo "`route`"
echo "-----------------------------------------------------------------------------"
#}
fi
#==================================================================================
#=========[ sysinfo - f ]=========================================================
#==================================================================================
if [ "$1" == "-f" ]; then
#{
./sysprofile -a > $outputfile
echo $outputfile
#}
fi
#==================================================================================
#=========[ sysinfo - help ]======================================================
#==================================================================================
if [ "$1" == "--help" -o "$1" == "-help" ]; then
#{
echo "Useage: sysinfo [OPTION]"
echo ""
echo " -s Hostname, Kernel, Distro and Runnung Time"
echo " -h Num CPUs, CPU Model, RAM, Free Ram, Used RAM"
echo " -n Int Name, Ip Address, MAC and Routing Table"
echo " -f Combination of '-s', '-h', '-s'"
echo " --To 'File-Report-[TIME].txt'"
echo " --help Sytinfo Options"
echo ""
#}
fi
#==================================================================================
#=========[ CleanUp ]============================================================
#==================================================================================
`rm -f $tempfile`