000-221 · Question #156
Within the context of a script, what must be considered when using stopsrc to stop a running subsystem?
The correct answer is B. Return code will be zero, regardless of outcome. The stopsrc command always returns exit code zero in scripts, regardless of whether the subsystem actually stopped, making return code checks unreliable for error handling.
Question
Within the context of a script, what must be considered when using stopsrc to stop a running subsystem?
Options
- AThe command can only run in the foreground.
- BReturn code will be zero, regardless of outcome.
- CReturn code will be non-zero should the subsystem fail to stop.
- DThe command will wait for the given subsystem to shutdown, before returning.
How the community answered
(68 responses)- A7% (5)
- B74% (50)
- C15% (10)
- D4% (3)
Why each option
The stopsrc command always returns exit code zero in scripts, regardless of whether the subsystem actually stopped, making return code checks unreliable for error handling.
stopsrc is not limited to foreground execution; it sends a stop request asynchronously to the SRC daemon.
The stopsrc command is designed to always return an exit code of zero regardless of the actual outcome of the stop request. This is a critical scripting concern because a script cannot rely on the return code to determine whether the subsystem successfully stopped - additional verification steps such as lssrc must be used instead.
This is the opposite of the actual behavior - stopsrc returns zero even on failure, not a non-zero code.
stopsrc sends the stop signal asynchronously and returns immediately without waiting for the subsystem to complete its shutdown.
Concept tested: AIX SRC stopsrc command return code behavior
Source: https://www.ibm.com/docs/en/aix/7.3?topic=s-stopsrc-command
Topics
Community Discussion
No community discussion yet for this question.