The HP-UX Parallel rc Framework
Some startu
p and shutdown scripts source the system configuration variables by executing
/etc/rc.config, which may not be needed since /sbin/rc would run them before invoking the
startup and shutdown scripts.
For example:
# source the system configuration variables
if [ -f /etc/rc.config ] ; then
. /etc/rc.config
else
echo "ERROR: /etc/rc.config defaults file MISSING"
fi
This sourcing is done to ensure that the required system configuration variables are set. This can
be changed to execute only the associated system configuration files.
This can be modified to the following:
# source the required configuration variables
if [ -f /etc/rc.config.d/myservice ]; then
. /etc/rc.config.d/myservice
else
echo "ERROR: /etc/rc.config.d/myservice defaults file MISSING"
fi
• Note: If your RC script requires configuration variables which may be present in
other services configuration files, then it may be required to source complete system
configuration variables.
5. Option to avoid saving log files of service
Some of the services generate log files and are saved by default. These log files may not be
required. Provide an option (configuration variable) to avoid saving log files that are generated.
• Note: Some of the log files are necessary for debugging in scenarios where the
system crashes.
6. Look for possible parallelization
Inspect the daemons and services for any performance improvement possibilities such as:
• Multi-threading the daemon
• Using better algorithms
• Optimization that can be done in the daemon initialization phase. Consider removing
unnecessary parts in the initialization of the daemon. Consider postponing any of the work to
be done to a later stage than the daemon initialization stage.
7. Look for optimization possibilities in the scripts
• Replace external commands with built-in commands wherever possible.
• Avoid piped commands (or) at-least reduce the number of commands in a pipe.
• Avoid back-quoted commands
• Cache the results of expensive operations if performed more than once (after
analyzing the dynamicity of the operations).
• Shell's math capabilities performs much faster than 'expr' and in-turn 'expr' is better
than 'bc'.