#!/bin/ksh # System Information # by Hermelito Go PATH=/usr/ccs/bin:/usr/sbin:/usr/bin export PATH alias d="/usr/ucb/echo -n" alias dnl=echo SunOS() { date d "Hostname: " hostname dnl uname -a dnl prtconf | head -2 | tail -1 dnl d "Host ID: " hostid d "Domain Name: " domainname dnl d "Domain Server: " ypwhich dnl echo "Local user Accounts:" cat /etc/passwd dnl echo "Pluggable Authentication Modules /etc/pam.conf:" grep -v '#' /etc/pam.conf dnl echo "Network Interface Cards:" ifconfig -a dnl echo "Network Routes:" netstat -rn dnl echo "/etc/defaultrouter:" if [ -f /etc/defaultrouter ] then cat /etc/defaultrouter dnl fi echo "/etc/networks:" if [ -f /etc/networks ] then grep -v '#' /etc/networks dnl fi echo "DNS /etc/resolv.conf:" if [ -f /etc/resolv.conf ] then cat /etc/resolv.conf fi dnl echo "Name Switch /etc/nsswitch.conf:" if [ -f /etc/nsswitch.conf ] then grep -v '#' /etc/nsswitch.conf dnl fi echo "Name service cache daemon configuration /etc/nscd.conf:" if [ -f /etc/nscd.conf ] then grep -v '#' /etc/nscd.conf dnl fi echo "Internet Daemons inetd:" if [ -f /etc/inetd.conf ] then grep -v '#' /etc/inetd.conf dnl fi echo "Daemons Scripts /etc/init.d:" ls -l /etc/init.d dnl echo "Runlevel 0 /etc/rc0.d:" ls -l /etc/rc0.d dnl echo "Runlevel 1 /etc/rc1.d:" ls -l /etc/rc1.d dnl echo "Runlevel 2 /etc/rc2.d:" ls -l /etc/rc2.d dnl echo "Runlevel 3 /etc/rc3.d:" ls -l /etc/rc3.d dnl echo "Runlevel 5 /etc/rc5.d:" ls -l /etc/rc5.d dnl echo "Runlevel 6 /etc/rc6.d:" ls -l /etc/rc6.d dnl echo "Runlevel S /etc/rcS.d:" ls -l /etc/rcS.d dnl echo "Share Table /etc/dfs/dfstab:" if [ -f /etc/dfs/dfstab ] then grep -v '#' /etc/dfs/dfstab dnl fi echo "NFS exported Directories:" showmount -e `hostname` if ! [ $? ] && [ -f /etc/exports ] then cat /etc/exports fi dnl echo "NFS Security /etc/nfssec.conf:" if [ -f /etc/nfssec.conf ] then grep -v '#' /etc/nfssec.conf dnl fi echo "Disks:" for i in `ls /dev/rdsk/*s2` do disk=`echo $i | cut -c11-16` format -d $disk >/tmp/$disk 2>&1 <&1 dnl rm /tmp/$disk done echo "Filesystem Tables /etc/vfstab:" cat /etc/vfstab dnl echo "Swap Devices:" swap -l dnl echo "Free Disk blocks:" df -k dnl echo "Volume Management /etc/vold.conf:" if [ -f /etc/vold.conf ] then grep -v '#' /etc/vold.conf dnl fi echo "Removable Media /etc/rmmount.conf:" if [ -f /etc/rmmount.conf ] then grep -v '#' /etc/rmmount.conf dnl fi echo "Remote Program Loader /etc/rpld.conf:" if [ -f /etc/rpld.conf ] then grep -v '#' /etc/rpld.conf dnl fi echo "System Log /etc/syslog.conf" if [ -f /etc/syslog.conf ] then grep -v '#' /etc/syslog.conf dnl fi echo "Printers:" lpstat -s dnl echo "Printer configuration /etc/printers.conf:" if [ -f /etc/printers.conf ] then grep -v '#' /etc/printers.conf dnl fi echo "Core dump /etc/coreadm.conf:" if [ -f /etc/coreadm.conf ] then grep -v '#' /etc/coreadm.conf dnl fi echo "System Crash Dump /etc/dumpadm.conf:" if [ -f /etc/dumpadm.conf ] then grep -v '#' /etc/dumpadm.conf dnl fi echo "Power Daemon /etc/power.conf:" if [ -f /etc/power.conf ] then grep -v '#' /etc/power.conf dnl fi echo "/opt Applications:" for i in `ls /opt | grep -v SUNW` do echo $i done dnl grep oracle /etc/passwd if [ $? ] && [ -f /var/opt/oracle/oratab ] then nl echo "Oracle Instances:" grep ':/' /var/opt/oracle/oratab nl ps -ef | grep ora_pmon | grep -v grep nl for h in `grep oracle /etc/passwd | cut -f6 -d: ` do echo $h if [ -f $h/.cshrc ] then echo $h/.cshrc grep ORACLE $h/.cshrc nl fi if [ -f $h/.profile ] then echo $h/.profile grep ORACLE $h/.profile nl fi done fi dnl echo "Licenses:" lic=`ps -ef | grep lmgrd | awk '{ printf $10 }'` echo $lic if [ $lic ] && [ -f $lic ] then cat $lic fi dnl echo "System Configurations:" echo "/etc/system" grep -v '*' /etc/system dnl echo "System Defaults:" for i in `ls /etc/default` do echo /etc/default/$i grep -v '#' /etc/default/$i dnl done echo "Device instance number file" cat /etc/path_to_inst dnl echo "Installed Packages:" pkginfo dnl echo "Installed Patches:" showrev -p dnl echo "Installed Modules:" modinfo dnl echo "Tunable Parameters:" sysdef -i dnl echo "END of Report" } # main case `uname` in 'SunOS') SunOS;; default) echo "Unsupported Platform :" uname;; esac