
Untitled
By: a guest on
Jun 16th, 2012 | syntax:
None | size: 1.19 KB | hits: 14 | expires: Never
#!/bin/bash
report=report.txt
temp=temp.txt
if [ "$1" == "-s" -o "$1" == "-a" ]; then
echo "Hostname: `hostname`"
echo "Kernel: `uname -r`"
echo "Distro: `cat /etc/issue | grep -m 1 ''`"
echo "Running: `uptime | awk '{print $3}' | tr -d \,`"
fi
if [ "$1" == "-h" -o "$1" == "-a" ]; then
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 | grep 'Mem' | awk '{print $2}'` MB"
echo "Free RAM: `free -m | grep 'Mem' | awk '{print $4}'` MB"
echo "Used RAM: `free -m | grep 'Mem' | awk '{print $3}'` MB"
fi
f [ "$1" == "-n" -o "$1" == "-a" ]; then
num=`ip add | grep -c ': '`
count=1
while [ $count -le $num ]
do
current=$count:
echo "`ip add | grep -m 1 -A 4 $current`" > $temp
echo -e "`cat $temp | grep -m 1 $current | awk '{print $2}'`\t`ip add | grep -m 1 'inet ' | awk '{print $2}'$
count=$(($count + 1))
done
echo "`route`"
fi
if [ "$1" == "-f" ]; then
./sysprofile.sh -a > $report
fi