Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

Error checking in startup scripts
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: Error checking in startup scripts
  • SDP: 6.5.0
  • Target: Any supported target
________________________________________________________________________

Recommendation
________________________________________________________________________

Currently, the return codes from any utils/services started in the startup scripts are ignored. Below is an example on how to add some logging to actually capture the return code and log the error:

# old version
mount -Tio-pkt -o fwpath=/var/FwImage/lib/dll/devnp-mv8688uap.so
start_production_test_server &


# new version

run_cmd "${LINENO:-}" log_error mount -Tio-pkt -o fwpath=/var/FwImage /lib/dll/devnp-mv8688uap.so
fork_cmd "${LINENO:-}" log_error start_production_test_server

Where would have defined fork_cmd() along the lines of the following:

fork_cmd()
{
local CLine="${1:-}"
local EHandler="${2:-}"
local RValue=0
shift 2
run_cmd "${EHandler}" "${CLine}" "${@}" &
#"${@}" &
RValue=$?
if [ ${RValue} -ne 0 ]; then
EMsg="Error Forking"
"${EHandler}" "${@}"
fi
return ${RValue}
}

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.