
4 Making Control Scripts and Commands DRD-Safe
This chapter describes the type of logic a packager or developer should look for to determine if a given control script or command is
Note:
Control scripts and commands are executing in a runcmd environment if the SW_SESSION_IS_DRD environment variable is set to 1.
4.1 Control Scripts Stopping, Starting or Restarting Processes/Daemons
Control scripts stopping, starting or restarting
Unsafe Examples:
•kill
•/sbin/init.d/comsec start
•vxdctl stop >/dev/null 2>&1
•init q
•inetd
Suggested Resolutions:
Follow the steps below to make the logic
1.If the logic is in a configure control script, no action is required. There are no DRD restrictions on configure scripts, which are executed during the boot of the system image rather than in the runcmd environment.
2.If the logic is part of a control script and is stopping a process, use the control_util
kill_named_procs to stop the process because that control utility is
3.If the logic is in a checkinstall, preinstall, or postinstall control script, and it can be moved to the configure script, move it to the configure script.
4.If none of the above solutions fit the situation, detect that the command is running in a runcmd environment using the SW_SESSION_IS_DRD environment variable, and change the logic to be
Safe Examples:
•[[ $SW_SESSION_IS_DRD != 1 ]] && kill
•if [[ $SW_SESSION_IS_UPDATE
/sbin/init.d/comsec start fi