My Advanced Linux/Bash shell scripts 2009. 7. 24. 16:49
안타깝게도 CPU 타잎 확인 하는 부분은 제대로 계산이 안된다.
이유는 쿼드코어, 코어2듀오, 듀얼코어, 하이퍼스레딩 등 때문에...
사실 좀 더 세밀하게 짜면 정상적으로 할 수있는데 귀찮아서..........
#!/bin/bash
LANG=C
unset GREP_OPTIONS GREP_COLOR
echo "
################################ SYSTEM CHECK uzoogom edition. ################################
1) Network Information-------------------------------------------------------------------------
1-1) HOSTNAME: `hostname`
1-2) Ethernet Information
`ifconfig | grep -v "127.0.0.1" | grep "addr"`
1-3) Route(gateway) Information
`route | egrep '(default|Gateway)'`
2) SYSTEM Information-------------------------------------------------------------------------
2-1)CPU Information
CPU : `cat /proc/cpuinfo | grep "processor" | wc -l` EA
`cat /proc/cpuinfo | grep "model name" | uniq`
`cat /proc/cpuinfo | grep "MHz" | uniq`
2-2) Memory Information
`free -m`
2-3) Partition Information
`fdisk -l | grep dev`
2-4) Disk Information
`df -h`
3) PROCESS Information-------------------------------------------------------------------------
`pstree`
4) Open Port Scanning-------------------------------------------------------------------------
`netstat -antp | egrep '(LISTEN|Address)'`
5) Auto start processor-------------------------------------------------------------------------
5-1) Crontab
`crontab -l`
5-2) chkconfig list
`chkconfig --list | grep "3:on"`
5-3) rc.local
`egrep -v "(#|touch)" /etc/rc.local`
"
이유는 쿼드코어, 코어2듀오, 듀얼코어, 하이퍼스레딩 등 때문에...
사실 좀 더 세밀하게 짜면 정상적으로 할 수있는데 귀찮아서..........
#!/bin/bash
LANG=C
unset GREP_OPTIONS GREP_COLOR
echo "
################################ SYSTEM CHECK uzoogom edition. ################################
1) Network Information-------------------------------------------------------------------------
1-1) HOSTNAME: `hostname`
1-2) Ethernet Information
`ifconfig | grep -v "127.0.0.1" | grep "addr"`
1-3) Route(gateway) Information
`route | egrep '(default|Gateway)'`
2) SYSTEM Information-------------------------------------------------------------------------
2-1)CPU Information
CPU : `cat /proc/cpuinfo | grep "processor" | wc -l` EA
`cat /proc/cpuinfo | grep "model name" | uniq`
`cat /proc/cpuinfo | grep "MHz" | uniq`
2-2) Memory Information
`free -m`
2-3) Partition Information
`fdisk -l | grep dev`
2-4) Disk Information
`df -h`
3) PROCESS Information-------------------------------------------------------------------------
`pstree`
4) Open Port Scanning-------------------------------------------------------------------------
`netstat -antp | egrep '(LISTEN|Address)'`
5) Auto start processor-------------------------------------------------------------------------
5-1) Crontab
`crontab -l`
5-2) chkconfig list
`chkconfig --list | grep "3:on"`
5-3) rc.local
`egrep -v "(#|touch)" /etc/rc.local`
"
후리켓 | 2009.10.08 16:06
테스트 패치ㅋ
--- test.sh.ori 2009-10-08 06:55:51.000000000 +0900
+++ test.sh 2009-10-08 06:55:27.000000000 +0900
@@ -2,6 +2,10 @@
LANG=C
unset GREP_OPTIONS GREP_COLOR
+if [ ! $LOGNAME = root ] && [ ! $UID = 0 ];then
+ exit
+fi
+
echo "
################################ SYSTEM CHECK uzoogom edition. ################################
--- test.sh.ori 2009-10-08 06:55:51.000000000 +0900
+++ test.sh 2009-10-08 06:55:27.000000000 +0900
@@ -2,6 +2,10 @@
LANG=C
unset GREP_OPTIONS GREP_COLOR
+if [ ! $LOGNAME = root ] && [ ! $UID = 0 ];then
+ exit
+fi
+
echo "
################################ SYSTEM CHECK uzoogom edition. ################################
0