存档

2008年7月 的存档

tcpping and Tcptraceroute’s use

2008年7月26日 1 条评论

tcpping使用TCP协议来检测网络状况,与平时使用的ping有所不同,ping使用的是ICMP协议。

tcpping是一个shell脚本,运行需要 tcptraceroute 的支持,所以真正起作用的是tcptraceroute

整体安装比较简单,具体顺序是先安装tcptraceroute,然后创建tcpping脚本。
注意: Tcptraceroute需要libcap和libnet的支持,这里暂不介绍。

假定已经编译好libcap和libnet
1.编译tcptraceroute
./configure –prefix=/usr/local/tcptraceroute –with-libpcap=/usr/local/libpcap –with-libnet=/usr/local/libnet –enable-static

安装好以后把tcptraceroute放到PATH路径,这样tcpping脚本可以找到tcptraceroute。

2.使用、语法
./tcptraceroute

tcptraceroute 1.5beta7
Copyright (c) 2001-2006 Michael C. Toren <mct@toren.net>
Updates are available from http://michael.toren.net/code/tcptraceroute/

Usage: tcptraceroute [-nNFSAE] [-i <interface>] [-f <first ttl>]
       [-l <packet length>] [-q <number of queries>] [-t <tos>]
       [-m <max ttl>] [-pP] <source port>] [-s <source address>]
       [-w <wait time>] <host> [destination port] [packet length]

#tcptraceroute www.google.com
Selected device eth0, address 212.106.15.83, port 40479 for outgoing packets
Tracing the path to www.google.com (64.233.189.99) on TCP port 80 (http), 30 hops max

 5  219.158.4.82  44.330 ms  44.258 ms  44.032 ms
 6  219.158.3.246  54.812 ms  54.760 ms  54.739 ms
 7  219.158.3.130  60.441 ms  60.436 ms  60.365 ms
 8  219.158.32.230  51.775 ms  49.505 ms  49.407 ms
 9  64.233.175.207  60.484 ms  60.637 ms  77.707 ms
10  66.249.94.34  49.639 ms  61.653 ms  54.145 ms
11  hk-in-f99.google.com (64.233.189.99) [open]  50.267 ms  50.059 ms  50.111 ms
 
和traceroute的区别
#traceroute www.google.com
traceroute: Warning: www.google.com has multiple addresses; using 64.233.189.104
traceroute to www-china.l.google.com (64.233.189.104), 30 hops max, 38 byte packets

 5  219.158.4.38 (219.158.4.38)  42.247 ms  42.551 ms  42.519 ms
 6  219.158.3.58 (219.158.3.58)  42.140 ms  42.107 ms  42.118 ms
 7  219.158.3.130 (219.158.3.130)  47.976 ms  47.900 ms  48.013 ms
 8  219.158.32.230 (219.158.32.230)  37.038 ms  36.947 ms  37.058 ms
 9  64.233.175.207 (64.233.175.207)  48.005 ms  47.987 ms  48.022 ms
10  66.249.94.6 (66.249.94.6)  50.673 ms 66.249.94.34 (66.249.94.34)  46.763 ms  37.104 ms
11  hk-in-f104.google.com (64.233.189.104)  47.841 ms  47.878 ms  47.826 ms

tcpping的使用:
./tcpping
tcpping v1.6 Richard van den Berg <richard@vdberg.org>

Usage: tcpping [-d] [-c] [-C] [-w sec] [-q num] [-x count] ipaddress [port]

        -d   print timestamp before every result
        -c   print a columned result line
        -C   print in the same format as fping’s -C option
        -w   wait time in seconds (defaults to 3)
        -r   repeat every n seconds (defaults to 1)
        -x   repeat n times (defaults to unlimited)

See also: man tcptraceroute
 http://michael.toren.net/code/tcptraceroute/

使用tcpping
#tcpping -c  www.google.com
0 1217065416 50.126 hk-in-f99.google.com (64.233.189.99)
1 1217065417 50.170 hk-in-f99.google.com (64.233.189.99)
2 1217065418 48.035 hk-in-f104.google.com (64.233.189.104)
3 1217065419 47.858 hk-in-f104.google.com (64.233.189.104)
4 1217065420 50.024 hk-in-f99.google.com (64.233.189.99)
5 1217065421 49.756 hk-in-f147.google.com (64.233.189.147)
6 1217065422 50.155 hk-in-f99.google.com (64.233.189.99)
7 1217065423 49.688 hk-in-f147.google.com (64.233.189.147)
可以看到google的几个不同IP。

使用ping
#ping www.google.com
PING www-china.l.google.com (64.233.189.147) 56(84) bytes of data.
64 bytes from hk-in-f147.google.com (64.233.189.147): icmp_seq=0 ttl=244 time=49.5 ms
64 bytes from hk-in-f147.google.com (64.233.189.147): icmp_seq=1 ttl=244 time=49.5 ms
64 bytes from hk-in-f147.google.com (64.233.189.147): icmp_seq=2 ttl=244 time=49.5 ms
64 bytes from hk-in-f147.google.com (64.233.189.147): icmp_seq=3 ttl=244 time=49.4 ms
64 bytes from hk-in-f147.google.com (64.233.189.147): icmp_seq=4 ttl=244 time=49.5 ms

其他具体的使用方法可以查看脚本的参数
      
# tcptraceroute –help

tcptraceroute 1.5beta7
Copyright (c) 2001-2006 Michael C. Toren <mct@toren.net>
Updates are available from http://michael.toren.net/code/tcptraceroute/

Usage: tcptraceroute [-nNFSAE] [-i <interface>] [-f <first ttl>]
       [-l <packet length>] [-q <number of queries>] [-t <tos>]
       [-m <max ttl>] [-pP] <source port>] [-s <source address>]
       [-w <wait time>] <host> [destination port] [packet length]
-n
    Display numeric output, rather than doing a reverse DNS lookup for each hop. By default, reverse lookups are never attempted on RFC1918
address space, regardless of the -n flag.
-N
    Perform a reverse DNS lookup for each hop, including RFC1918 addresses.
-f
    Set the initial TTL used in the first outgoing packet. The default is 1.
-m
    Set the maximum TTL used in outgoing packets. The default is 30.
-p
    Use the specified local TCP port in outgoing packets. The default is to obtain a free port from the kernel using bind(2). Unlike with traditional
traceroute(8), this number will not increase with each hop.
-s
    Set the source address for outgoing packets. See also the -i flag.
-i
    Use the specified interface for outgoing packets.
-q
    Set the number of probes to be sent to each hop. The default is 3.
-w
    Set the timeout, in seconds, to wait for a response for each probe. The default is 3.
-S
    Set the TCP SYN flag in outgoing packets. This is the default, if neither -S or -A is specified.
-A
    Set the TCP ACK flag in outgoing packets. By doing so, it is possible to trace through stateless firewalls which permit outgoing TCP connections.
-E
    Send ECN SYN packets, as described in RFC2481.
-t
    Set the IP TOS (type of service) to be used in outgoing packets. The default is not to set any TOS.
-F
    Set the IP “don’t fragment” bit in outgoing packets.
-l
    Set the total packet length to be used in outgoing packets. If the length is greater than the minimum size required to assemble the necessary probe
packet headers, this valu
e is automatically increased.
-d
    Enable debugging, which may or may not be useful.

下面是tcpping的脚本:
tcpping

分类: OpenSource, security 标签:

linux 下su 和su – 并不一样

2008年7月16日 评论已被关闭

 

习惯总是使用su来切换用户,但是今天在修改了新用户的环境变量后发现su 和su – 还存在些许区别。

su newuser保留原来用户(olduser)的环境变量,新用户下的环境bash设置无效。

而 su – newuser 则使用newuser的环境变量,新用户的~/.bash_profile生效。

 

分类: OpenSource 标签:

use Volano对jvm的性能进行测试

2008年7月13日 评论已被关闭

使用Volano对jvm性能测试

网络测试报告:
http://www.volano.com/report/index.html

一、以下是2hei的测试情况:
原理:
启动volano server 会根据jdk的版本来设定默认的jvm值,然后启动简化版的Tomcat,并部署VolanoChat聊天系统;
启动客户端对VolanoChat进行连接,客户端模拟聊天者并发发送大量的消息,来测试jvm的性能。

使用JDK1.6

设定1.6的环境变量
export JAVA_HOME=/home/jdk1.6.0_06
export PATH=$JAVA_HOME/bin:$PATH

启动server:

./loopserver.sh sun16
java version “1.6.0_06”
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)

/home/jdk1.6.0_06/bin/java -server -Xmx64m -Dinstall.root=. -Dcatalina.home=. -cp .:lib/bootstrap.jar:lib/catalina.jar:lib/naming-common.jar:lib/naming-resources.jar:lib/servlet.jar:lib/servlets-common.jar:lib/servlets-default.jar:lib/volanochat-server.jar:lib/xerces.jar COM.volano.Main

VolanoChat(TM) Server Version 2.5.0.9
Copyright (C) 1996-2002 Volano LLC.  All rights reserved.
Loading server properties from “/home/www.2hei.net/soft/voooo/conf/properties.txt”.
www.2hei.net:8000  VolanoChatPro – unlimited connections.
Apache Tomcat/4.0.3

启动client,对server进行压力测试
./loopclient.sh sun16

ulimit -Sn = 1024

java version “1.6.0_06”
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)

/home/jdk1.6.0_06/bin/java -server -Xmx64m -Dinstall.root=. -Dcatalina.home=. -cp .:lib/bootstrap.jar:lib/catalina.jar:lib/naming-common.jar:lib/naming-resources.jar:lib/servlet.jar:lib/servlets-common.jar:lib/servlets-default.jar:lib/volanochat-server.jar:lib/xerces.jar COM.volano.Mark -run

执行结果:
java.vendor        = Sun Microsystems Inc.
java.vendor.url    = http://java.sun.com/
java.version       = 1.6.0_06
java.class.version = 50.0
java.compiler      = null
os.name            = Linux
os.version         = 2.6.9-67.0.15.ELsmp
os.arch            = i386

VolanoMark version = 2.5.0.9
Messages sent      = 20000
Messages received  = 380000
Total messages     = 400000
Elapsed time       = 12.862 seconds
Average throughput = 31099 messages per second

使用JDK1.4:

设定1.4的环境变量
export JAVA_HOME=/home/j2sdk1.4.2_17
export PATH=$JAVA_HOME/bin:$PATH

./loopserver.sh sun14
ulimit -Sn = 1024

java version “1.4.2_17”
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_17-b06)
Java HotSpot(TM) Server VM (build 1.4.2_17-b06, mixed mode)

/home/j2sdk1.4.2_17/bin/java -server -Xmx64m -Dinstall.root=. -Dcatalina.home=. -cp .:lib/bootstrap.jar:lib/catalina.jar:lib/naming-common.jar:lib/naming-resources.jar:lib/servlet.jar:lib/servlets-common.jar:lib/servlets-default.jar:lib/volanochat-server.jar:lib/xerces.jar COM.volano.Main

VolanoChat(TM) Server Version 2.5.0.9
Copyright (C) 1996-2002 Volano LLC.  All rights reserved.
Loading server properties from “/home/www.2hei.net/soft/voooo/conf/properties.txt”.
www.2hei.net:8000  VolanoChatPro – unlimited connections.
Apache Tomcat/4.0.3

./loopclient.sh sun14
ulimit -Sn = 1024

java version “1.4.2_17”
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_17-b06)
Java HotSpot(TM) Server VM (build 1.4.2_17-b06, mixed mode)

/home/j2sdk1.4.2_17/bin/java -server -Xmx64m -Dinstall.root=. -Dcatalina.home=. -cp .:lib/bootstrap.jar:lib/catalina.jar:lib/naming-common.jar:lib/naming-resources.jar:lib/servlet.jar:lib/servlets-common.jar:lib/servlets-default.jar:lib/volanochat-server.jar:lib/xerces.jar COM.volano.Mark -run

执行结果:
java.vendor        = Sun Microsystems Inc.
java.vendor.url    = http://java.sun.com/
java.version       = 1.4.2_17
java.class.version = 48.0
java.compiler      = null
os.name            = Linux
os.version         = 2.6.9-67.0.15.ELsmp
os.arch            = i386

VolanoMark version = 2.5.0.9
Messages sent      = 20000
Messages received  = 380000
Total messages     = 400000
Elapsed time       = 15.739 seconds
Average throughput = 25415 messages per second

二、测试结论:

在同等的硬件配置及操作系统下,测试每次都发送400000条数据,从执行时间和吞吐量上看jdk1.6的性能要比jdk1.4的高一些,
如吞吐量分别是每秒31099,25415。

 

网上其他的关于jdk性能的比较

下面是sun对与J2SE 1.4.2 和J2SE 5.0的性能比较

http://java.sun.com/performance/reference/whitepapers/5.0_performance.html

sun五个升级到jdk1.5的原因。  比如性能优化,稳定性优化,还有64位的支持等等

http://java.sun.com/developer/technicalArticles/J2SE/5reasons.html

分类: java 标签: ,

用siege做http的压力测试

2008年7月11日 评论已被关闭

siege是一个开源的压力测试用具,有点类似apache的ab

http://www.joedog.org/Siege/Manual
download from ftp://ftp.joedog.org/pub/siege
 
./configure –prefix=/home/siege && make  && make install

[root@ bin]# ./siege
SIEGE 2.67
Usage: siege [options]
       siege [options] URL
       siege -g URL
Options:
  -V, –version           VERSION, prints version number to screen.
  -h, –help              HELP, prints this section.
  -C, –config            CONFIGURATION, show the current configuration.
  -v, –verbose           VERBOSE, prints notification to screen.
  -g, –get               GET, pull down headers from the server and display HTTP
                          transaction. Great for web application debugging.
  -c, –concurrent=NUM    CONCURRENT users, default is 10
  -u, –url=”URL”         Deprecated. Set URL as the last argument.
  -i, –internet          INTERNET user simulation, hits the URLs randomly.
  -b, –benchmark         BENCHMARK, signifies no delay for time testing.
  -t, –time=NUMm         TIME based testing where “m” is the modifier S, M, or H
                          no space between NUM and “m”, ex: –time=1H, one hour test.
  -r, –reps=NUM          REPS, number of times to run the test, default is 25
  -f, –file=FILE         FILE, change the configuration file to file.
  -R, –rc=FILE           RC, change the siegerc file to file.  Overrides
                          the SIEGERC environmental variable.
  -l, –log               LOG, logs the transaction to PREFIX/var/siege.log
  -m, –mark=”text”       MARK, mark the log file with a string separator.
  -d, –delay=NUM         Time DELAY, random delay between 1 and num designed
                          to simulate human activity. Default value is 3
  -H, –header=”text”     Add a header to request (can be many)
  -A, –user-agent=”text” Sets User-Agent in request
 
 
  siege 的使用方法
 
  $ ./siege -u www.google.com -d1 -r10 -c25
  -u has been deprecated.
  提示-u参数已经不推荐了
 
也可以使用url列表的方式:

  ./siege -c 20 -r 30 -f url.txt
 
 
 vi url.txt
  http://www.google.com

运行的结果如下:

** SIEGE 2.67
** Preparing 20 concurrent users for battle.
The server is now under siege…
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6375 bytes ==> /
HTTP/1.1 200   0.17 secs:    6375 bytes ==> /
HTTP/1.1 200   0.18 secs:    6385 bytes ==> /
HTTP/1.1 200   0.18 secs:    6375 bytes ==> /
HTTP/1.1 200   0.33 secs:    6385 bytes ==> / 
  done.
Transactions:                    600 hits
Availability:                 100.00 %
Elapsed time:                  24.53 secs
Data transferred:               3.66 MB
Response time:                  0.18 secs
Transaction rate:              24.46 trans/sec
Throughput:                     0.15 MB/sec
Concurrency:                    4.46
Successful transactions:         600
Failed transactions:               0
Longest transaction:            3.40
Shortest transaction:           0.17
 
FILE: /home/siege/var/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive ‘show-logfile’ to false.

分类: OpenSource 标签: ,

使用Jconsole对java的内存使用情况(JVM)进行监控

2008年7月10日 评论已被关闭

 

JDK1.5提供JMX remote的管理工具Jconsole,可以监控Java运行程序的内存使用情况、活动线程数量、类装载的数量、MBeans的状态、虚拟机的各种信息等,还可以执行MBean公开的方法或强制进行垃圾回收。因为Apusic应用服务器实现标准的JMX接口,因此也可以使用Jconsole进行监控。

下面是在windows端对Linux的java应用(Resin)的JVM进行监控。
windows: 安装 jdk1.6.0_06  http://java.sun.com/javase/downloads/index.jsp
Linux:Resin2.1.x + jdk1.6

启动resin ,增加jvm监控的指令:
可以在java启动参数添加,
如: httpd.sh  或者 wrapper.pl 里面
vi http.sh
args=”***” 把 需要启动jvm选项加入。

#指定远程服务器的端口
-Dcom.sun.management.jmxremote.port=12345
#指定远程服务器的用户认证
-Dcom.sun.management.jmxremote.password.file=$JRE_HOME/lib/management/password.properties
-Dcom.sun.management.jmxremote.access.file=$JRE_HOME/lib/management/access.properties

使用密码:
#JRE_HOME/lib/management/jmxremote.password.template
cp jmxremote.password.template password.properties
chmod 600 password.properties
#默认用户名 密码为:
monitorRole QED
controlRole R&D
#默认权限
#cp jmxremote.access access.properties 
#设置权限
monitorRole   readonly
controlRole   readwrite

#也可以使用禁止用户认证
com.sun.management.jmxremote.authenticate=false

也可以使用ssl连接

这里先不用
com.sun.management.jmxremote.ssl=false

说明: 如果没有启动com.sun.management.jmxremote 的配置 , 远程连接会提示:
error during jrmp connection establishment ; nested exception is

如果无法连接有可能是linux服务器的hostname存在问题

#修改hostname
/etc/hosts  把127.0.0.1修改为外网卡IP,如192.168.1.100
还有
/etc/sysconfig/network

#启动resin
$RESIN_HOME/bin/http.sh start
#查看是否已经启动
#ps -x
8681 pts/0    S      0:00 perl bin/wrapper.pl -chdir -name httpd -class com.caucho.server.http.HttpServer -J-server -verbose -Dcom.
8683 pts/0    Sl     0:04 /home/2hei.net/jdk1.6.0_06/bin/java -server -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremo
#查看端口
#netstat -an
tcp        0      0 127.0.0.1:35844             127.0.0.1:35848             ESTABLISHED
tcp        0      0 :::8080                     :::*                        LISTEN
tcp        0      0 :::12345                    :::*                        LISTEN

-Dcom.sun.management.jmxremote.authenticate=false
#是否使用ssl
-Dcom.sun.management.jmxremote.ssl=false”

windows下
jconsole命令在 $JAVA_HOME/bin 下

cmd:\>jconsole
#启动

jvm_6.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

连接远程
192.168.1.100:12345
controlRole R&D

jvm_1.png

 

 

 

 

 

 

 

 

 

 

 

jvm_2.png

 

 

 

 

 

 

 

 

 

 

 

jvm_4.png

 

 

 

 

 

 

 

 

 

 

 

 

参考:
http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html

http://java.sun.com/javase/6/docs/technotes/tools/solaris/keytool.html

分类: java, OpenSource 标签: , ,

shell 的变量作用域

2008年7月8日 评论已被关闭

shell变量的作用域
while read line
  do
    str[$i]=$line1
    echo $i
    echo ${str[i]}
    let i=i+1
  done  < data
 
  len=${#str[@]}
  echo $len
 
  $len长度为实际data文件的行数
  str[]变量的作用域一直有效
  ===================
  cat data|while read line
  do
    str[$i]=$line1
    echo $i
    echo ${str[i]}
    let i=i+1
  done
 
  len=${#str[@]}
  echo $len
 
  $len长度为0
 
  说明str[]变量的作用域到done结束即失效。
 
  原因是局部变量是普通的变量,仅在创建它的Shell中有效。
   cat data|while read line  使用了管道符 “|”
  表明父shell中的局部变量不会传递到子shell中

分类: OpenSource, shell 标签:

kernel panic – not syncing: 的思考

2008年7月5日 2 条评论

kernel panic 出错会在屏幕上显示,看了下message文件、并没有相关记录。

kernel panic 主要有以下几个出错提示:

kernel panic – not syncing: Attempted to kill the idle task!
kernel panic – not syncing: killing interrupt handler!
Kernel Panic – not syncing:Attempted to kill init !

查看了一下 linux的源码文件,找到相关位置

kernel/panic.c

NORET_TYPE void panic(const char * fmt, …)
{
    static char buf[1024];
    va_list args;

    bust_spinlocks(1);
    va_start(args, fmt);
    vsnprintf(buf, sizeof(buf), fmt, args);
    va_end(args);
    printk(KERN_EMERG “Kernel panic – not syncing: %s\n”,buf);
    bust_spinlocks(0);
    
   
kernel/exit.c

    if (unlikely(in_interrupt()))
        panic(“Aiee, killing interrupt handler!”);     #中断处理
    if (unlikely(!tsk->pid))
        panic(“Attempted to kill the idle task!”);     #空任务
    if (unlikely(tsk->pid == 1))
        panic(“Attempted to kill init!”);              #初始化
       

       
从其他源文件和相关文档看到应该有几种原因:

1、硬件问题

使用了 SCSI-device 并且使用了未知命令

#WDIOS_TEMPPANIC        Kernel panic on temperature trip
#   
#        The SETOPTIONS call can be used to enable and disable the card
#    and to ask the driver to call panic if the system overheats.
#   
#    If one uses a SCSI-device of unsupported type/commands, one
#      immediately runs into a kernel-panic caused by Command Error. To better
#      understand which SCSI-command caused the problem, I extended this
#      specific panic-message slightly.
#     
#read/write causes a command error from
#      the subsystem and this causes kernel-panic

2、系统过热
如果系统过热会调用panci,系统挂起

#WDIOS_TEMPPANIC        Kernel panic on temperature trip
#   
#        The SETOPTIONS call can be used to enable and disable the card
#      and to ask the driver to call panic if the system overheats.

3、文件系统引起

#A variety of panics and hangs with /tmp on a reiserfs  filesystem
#Any other panic, hang, or strange behavior
#
#  It turns out that there’s a limit of six environment variables on the
#  kernel command line.  When that limit is reached or exceeded, argument
#  processing stops, which means that the ‘root=’ argument that UML
#  usually adds is not seen.  So, the filesystem has no idea what the
#  root device is, so it panics.
#  The fix is to put less stuff on the command line.  Glomming all your
#  setup variables into one is probably the best way to go.

Linux内核命令行有6个环境变量。如果即将达到或者已经超过了的话 root= 参数会没有传进去
启动时会引发panics错误。

vi grub.conf
#####################
title Red Hat Enterprise Linux AS (2.6.9-67.0.15.ELsmp)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-67.0.15.ELsmp ro root=LABEL=/
        initrd /boot/initrd-2.6.9-67.0.15.ELsmp.img
title Red Hat Enterprise Linux AS-up (2.6.9-67.EL)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-67.EL ro root=LABEL=/
        initrd /boot/initrd-2.6.9-67.EL.img

应该是 其中的 root=LABEL=/   没有起作用。

4、内核更新
网上相关文档多半是因为升级内核引起的,建议使用官方标准版、稳定版

另外还有使用磁盘的lvm 逻辑卷,添加CPU和内存。可在BIOS中禁掉声卡驱动等不必要的设备。

也有报是ext3文件系统的问题。
解决: 手工编译内核,把 ext3相关的模块都编译进去,
 

5、处理panic后的系统自动重启

panic.c源文件有个方法,当panic挂起后,指定超时时间,可以重新启动机器

if (panic_timeout > 0)
    {
        int i;
        /*
          * Delay timeout seconds before rebooting the machine.
         * We can’t use the “normal” timers since we just panicked..
          */
        printk(KERN_EMERG “Rebooting in %d seconds..”,panic_timeout);
        for (i = 0; i < panic_timeout; i++) {
            touch_nmi_watchdog();
            mdelay(1000);
        }
       
修改方法:
/etc/sysctl.conf文件中加入
kernel.panic = 30    #panic错误中自动重启,等待时间为30秒
kernel.sysrq=1       #激活Magic SysRq!  否则,键盘鼠标没有响应  

分类: OpenSource 标签: ,