Linux Box Information Script (SUP)

http://www.suseblog.com/tools/

#!/bin/bash
 
# COLLECT SOME INFO
IFS=$'\n'
UPTIME=`uptime`
D_UP=${UPTIME:1}
MYGROUPS=`groups`
DATE=`date`
KERNEL=`uname -a`
CPWD=`pwd`
ME=`whoami`
 
# OUTPUT THE DATA
#printf "  user:\t\t"$USER" (uid:"$UID")\n"
printf "  User:\t\t"$ME" (uid:"$UID")\n"
printf "  Groups:\t"$MYGROUPS"\n"
printf "  Working dir:\t"$CPWD"\n"
printf "  Home dir:\t"$HOME"\n"
printf "  Hostname:\t"$HOSTNAME"\n"
ip -o addr | awk '/inet /{print "  IP (" $2 "):\t" $4}'
#lspci | grep "Ethernet controller:\|Network controller:" | awk '
#/Ethernet controller:/{printf "  Ethernet NIC:\t"
#i=4
#while(i<=NF){
#        printf $i
#        if(i<NF){
#                printf " "
#        }
#        i++
#}
#printf "\n"
#}
#/Network controller/{printf "  Network Card:\t"
#i=4
#while(i<=NF){
#        printf $i
#        if(i<NF){
#                printf " "
#        }
#        i++
#}
#printf "\n"
#}'
/sbin/route -n | tail -n 1 | awk '/0.0.0.0/{ printf "  Gateway:\t" $2 "\n"}'
cat /etc/resolv.conf | tail -n 4 | awk '/nameserver/{ printf "  Name Server:\t" $2 "\n"}'
printf "  Date:\t\t"$DATE"\n"
printf "  Uptime:\t"$D_UP"\n"
printf "  Kernel:\t"$KERNEL"\n"
free -mot | awk '
/Mem/{print "  Memory:\tTotal: " $2 "Mb\tUsed: " $3 "Mb\tFree: " $4 "Mb"}
/Swap/{print "  Swap:\t\tTotal: " $2 "Mb\tUsed: " $3 "Mb\tFree: " $4 "Mb"}'
printf "  Architecture:\t"$CPU"\n"
cat /proc/cpuinfo | grep "model name\|processor" | awk '
/processor/{printf "  Processor:\t" $3 " : " }
/model\ name/{
i=4
while(i<=NF){
	printf $i
	if(i<NF){
		printf " "
	}
	i++
}
printf "\n"
}'
 
#lspci | grep "Audio device:\|VGA compatible" | awk '
#/Audio device/{printf "  Audio:\t"
#i=4
#while(i<=NF){
#        printf $i
#        if(i<NF){
#                printf " "
#        }
#        i++
#}
#printf "\n"
#}
#/VGA compatible/{printf "  Graphics:\t"
#i=5
#while(i<=NF){
#        printf $i
#        if(i<NF){
#                printf " "
#        }
#        i++
#}
#printf "\n"
#}'

 
info/nix/linux/scripts/sup-script.txt · Последние изменения: 2009/11/12 01:04 От dant
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki