kdumpctl:print out the service status

In kdumpctl, some printings are incomplete, like "Starting kdump:" or
"Stopping kdump:". Now add the service status to the end of such kind
of printing.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Baoquan He 2013-02-18 17:05:42 +08:00
parent dd02c559ae
commit c8ce08763f

View File

@ -349,24 +349,24 @@ function start()
local nr local nr
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
[ $nr -gt 1 ] && { [ $nr -gt 1 ] && {
echo -n "Error: More than one dump targets specified"; echo echo "More than one dump targets specified: [WARNING]"
return 1 return 1
} }
save_raw save_raw
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -n "Starting kdump:"; echo echo "Starting kdump: [FAILED]"
return 1 return 1
fi fi
status status
rc=$? rc=$?
if [ $rc == 2 ]; then if [ $rc == 2 ]; then
echo -n "Kdump is not supported on this kernel"; echo echo "Kdump is not supported on this kernel: [WARNING]"
return 1; return 1;
else else
if [ $rc == 0 ]; then if [ $rc == 0 ]; then
echo -n "Kdump already running"; echo echo "Kdump already running: [WARNING]"
return 0 return 0
fi fi
fi fi
@ -375,34 +375,34 @@ function start()
check_config check_config
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo -n "Starting kdump:"; echo echo "Starting kdump: [FAILED]"
return 1 return 1
fi fi
load_kdump load_kdump
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo -n "Starting kdump:"; echo echo "Starting kdump: [FAILED]"
return 1 return 1
fi fi
echo -n "Starting kdump:"; echo echo "Starting kdump: [OK]"
} }
function stop() function stop()
{ {
$KEXEC -p -u 2>/dev/null $KEXEC -p -u 2>/dev/null
if [ $? == 0 ]; then if [ $? == 0 ]; then
echo -n "Stopping kdump:"; echo echo "kexec: unloaded kdump kernel"
echo -n "kexec: unloaded kdump kernel" echo "Stopping kdump: [OK]"
return 0 return 0
else else
echo -n "Stopping kdump:"; echo echo "kexec: failed to unloaded kdump kernel"
echo -n "kexec: failed to unloaded kdump kernel" echo "Stopping kdump: [FAILED]"
return 1 return 1
fi fi
} }
if [ ! -f "$KDUMP_CONFIG_FILE" ]; then if [ ! -f "$KDUMP_CONFIG_FILE" ]; then
echo -n "No kdump config file found!"; echo echo "Error: No kdump config file found!" >&2
exit 1 exit 1
fi fi