Wrapping up this work week, it occured to me that I'd spent all my time on Linux and none on Unix (A bad thing? Judgement call ;)
In any event, I thought it would be somewhat equalizing if I put together one of my basic shell scripts, specifically for Solaris, that you can be run on any Unix system (although you'll need root privilege to ensure that all of these commands give you the information you want) and print up a nicely formatted listing of system information.
When run in an SSH shell loop, it can be a quick and tidy way to put together a system inventory to keep the big dogs happy ;) You can run it simply by calling it on the system you're running it on, like so:
./solinfo.sh
Cheers; enjoy your weekend :)
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License#!/bin/sh
#
# solinfo.sh
#
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#
echo "hostname: \c"
/usr/bin/hostname
echo
echo "model: \c"
/usr/bin/uname -mi
echo
echo "cpu count: \c"
/usr/bin/dmesg|grep cpu|sed 's/.*\(cpu.*\)/\1/'|awk -F: '{print $1}'|sort -u|wc -l
echo
echo "disks online: \c"
echo "^D"|format 2>/dev/null|grep ".\. "|wc -l
echo
echo "disk types:"
echo
echo "^D"|format 2>/dev/null|grep ".\. "
echo
echo "dns name and aliases:"
echo
nslookup `hostname`|grep Name;nslookup `hostname`|sed -n '/Alias/,$p'
echo
echo "Interfaces:"
echo
netstat -in|grep -v Name|grep -v lo0|awk '{print "Name: " $1 " : IP: " $4}'
echo
echo "Access Restrictions:"
echo
if [ -f /etc/hosts.allow ]
then
cat /etc/hosts.allow
else
echo "No host based access restrictions in place"
fi
echo
echo "OS Release: \c"
uname -r
, Mike
linux unix internet technology
Friday, February 1, 2008
Solaris Shell Script To Gather Basic System Info
Posted by Mike Golvach at 12:43 AM
information, inventory, linux, shell, shell scripts, solaris, system, unix