Technical data

8. Documentation for Developers
assignments should be used. A path under /var/run/ makes sense for transient data,
while for persistent data it is advised to use the function map2persistent (Page 318)
combined with a suitable configuration variable.
Stop Scripts in opt/etc/rc0.d/
Each machine must be shut down or restarted from time to time. It is perfectly possible that
you have to perform operations before the computer is shut down or restarted. To shut down
and restart the commands “halt” or “reboot” are used. These commands are also invoked
when the corresponding buttons in IMONC or the Web GUI are clicked.
All stop scripts can be found in the opt/etc/rc0.d/. The file names have to be created
using the same rules as for the scripts. They are as well executed in ascending order of numbers.
8.7.3. Helper Functions
/etc/boot.d/base-helper provides a number of different functions that can be used in Start-
and other scripts. They contian support for debugging, loading of kernel modules, or message
output. The functions are listed and explained in short below
Script Control
begin_script <Symbol> <Message>: Output of a message and activation of script debugging
by calling set -x, if <Symbol>_DO_DEBUG is set to “yes”.
end_script: Output of an end-message and deactivation of debugging if it was activated with
begin_script. For each begin_script call a corresponding end_script call has to exist
(and vice versa).
Loading Of Kernel Modules
do_modprobe [-q] <Modul> <Parameter>*: Loads a kernel module including its parameters
(if needed) while resolving its module dependencies. The parameter “-q” prevents error
messages to be written to the console and to the boot log in case of failure. The function
returns 0 for success and another value in case of error. This enables you to create code
for handling failures while loading kernel modules:
if do_modprobe -q acpi-cpufreq
then
# no CPU frequency scaling via ACPI
log_error "CPU frequency scaling via ACPI not available!"
# [...]
else
log_info "CPU frequency scaling via ACPI activated."
# [...]
fi
do_modrobe_if_exists [-q] <Module path> <Module> <Parameter>*:
Checks if the module /lib/modules/<Kernel-Version>/<Module path>/<Module> ex-
ists and, if so, invokes do_modprobe.
333