kdumpctl: cleanup 'stop'
Like for 'start' move the printing of the error message to the calling function. This not only makes the code more consistent to 'start' but also prevents 'kdumpctl restart' to call 'start' in case 'stop' has failed. This doesn't impact the case when 'kdumpctl restart' is run without any crash kernel being loaded as kexec will still return success in that case. Signed-off-by: Philipp Rudo <prudo@redhat.com> Reviewed-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
parent
33b307af20
commit
5eefcf2e94
20
kdumpctl
20
kdumpctl
@ -1090,15 +1090,9 @@ reload_fadump()
|
||||
stop()
|
||||
{
|
||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||
stop_fadump
|
||||
stop_fadump || return
|
||||
else
|
||||
stop_kdump
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if [[ $? != 0 ]]; then
|
||||
derror "Stopping kdump: [FAILED]"
|
||||
return 1
|
||||
stop_kdump || return
|
||||
fi
|
||||
|
||||
dinfo "Stopping kdump: [OK]"
|
||||
@ -1683,7 +1677,10 @@ main()
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
if ! stop; then
|
||||
derror "Stopping kdump: [FAILED]"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
EXIT_CODE=0
|
||||
@ -1704,7 +1701,10 @@ main()
|
||||
reload
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
if ! stop; then
|
||||
derror "Stopping kdump: [FAILED]"
|
||||
exit 1
|
||||
fi
|
||||
if ! start; then
|
||||
derror "Starting kdump: [FAILED]"
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user