Este conteúdo não está disponível no idioma selecionado.
31.7. Persistent Module Loading
As shown in Example 31.1, “Listing information about a kernel module with lsmod”, many kernel modules are loaded automatically at boot time. You can specify additional modules to be loaded by creating a new
<file_name>.modules
file in the /etc/sysconfig/modules/
directory, where <file_name> is any descriptive name of your choice. Your <file_name>.modules
files are treated by the system startup scripts as shell scripts, and as such should begin with an interpreter directive (also called a “bang line”) as their first line:
Example 31.6. First line of a file_name.modules file
#!/bin/sh
Additionally, the
<file_name>.modules
file should be executable. You can make it executable by running:
modules]# chmod +x <file_name>.modules
For example, the following
bluez-uinput.modules
script loads the uinput
module:
Example 31.7. /etc/sysconfig/modules/bluez-uinput.modules
#!/bin/sh if [ ! -c /dev/input/uinput ] ; then exec /sbin/modprobe uinput >/dev/null 2>&1 fi
The
if
-conditional statement on the third line ensures that the /dev/input/uinput
file does not already exist (the !
symbol negates the condition), and, if that is the case, loads the uinput
module by calling exec /sbin/modprobe uinput
. Note that the uinput
module creates the /dev/input/uinput
file, so testing to see if that file exists serves as verification of whether the uinput
module is loaded into the kernel.
The following
>/dev/null 2>&1
clause at the end of that line redirects any output to /dev/null
so that the modprobe
command remains quiet.