CentOS启动时自动加载内核模块

http://bluedata.org/2008/06/14/centos_rhel-auto-load-modules/

CentOS4(RHEL4) 的 /etc/rc.sysinit 文件中有这样一段:

# Loadmodules(forbackwardcompatibilitywithVARs)if[ -f /etc/rc.modules]; then        /etc/rc.modulesfi

所以,可以创建 /etc/rc.modules 文件来加载模块。如: vi /etc/rc.modules

#!/bin/sh # # Thisscriptwillbeloadotheruser-definedmodules.modprobesoftdog

chmod +x /etc/rc.modules

而在 CentOS5(RHEL5) 的 /etc/rc.sysinit 文件的上述一段之前还有一段:

# Load other user-defined modulesforfilein /etc/sysconfig/modules/*.modules ; do   [ -x $file ] && $file done

可以参照 /etc/sysconfig/modules 目录下的 udev-stw.modules 创建一个以xxxx .modules 结尾的可执行文件来加载模块。

所以在/etc/sysconfig/modules 目录下新建一个名为xxx.modules 的文件,并且赋值权限为755即可。

 

posted @ 2012-03-19 14:17  google4y  阅读(829)  评论(0编辑  收藏  举报
不在家,就在公司,不在公司,就在去公司的路上,無家無根,如風如萍,只有漂