I needed to autoload some modules on some CentOS boxen and had a really hard time finding the most modern way to load them. After having them in /etc/rc.d/rc.local i found that i could also put them into /etc/rc.modules which then helped me find the following lines in /etc/rc.sysinit:

# Load other user-defined modules
for file in /etc/sysconfig/modules/*.modules ; do
[ -x $file ] && $file
done
# Load modules (for backward compatibility with VARs)
if [ -f /etc/rc.modules ]; then
/etc/rc.modules
fi

The cleanest way therefore seems to be like so:

echo "modprobe some_module" > /etc/sysconfig/modules/something.modules
chmod +x /etc/sysconfig/modules/something.modules

This kind of files could even be installed from a RPM without needing any special pre-install/uninstall handling.
This probably also applies to various Flavor of Redhat and Fedora. Personally i prefer gentoos nice modules.autoload file.
OS | 评论(0) | 引用(0) | 阅读(2641)