Hi,
When I recheck the code I found that I missed the kdumpctl status code patch
Will resend the 2/2 soon.
On 02/12/14 at 10:31am, Dave Young wrote:
Move the code to check /sys/kernel/kexec_crash_loaded to function
check_kdump_feasibility(). And rename status() to check_current_kdump_status()
so these two functions become clearer.
Tested with kernel without CONFIG_KEXEC
Tested with run kdumpctl start two times.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
kdumpctl | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index aef3875..925a3b0 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -384,12 +384,8 @@ function propagate_ssh_key()
}
-function status()
+function check_current_kdump_status()
{
- if [ ! -e /sys/kernel/kexec_crash_loaded ]
- then
- return 2
- fi
rc=`cat /sys/kernel/kexec_crash_loaded`
if [ $rc == 1 ]; then
return 0
@@ -535,6 +531,11 @@ function check_kdump_feasibility()
echo "Secure Boot is Enabled. Kdump service can't be started. Disable Secure
Boot and retry"
return 1;
fi
+
+ if [ ! -e /sys/kernel/kexec_crash_loaded ]; then
+ echo "Kdump is not supported on this kernel"
+ return 1
+ fi
}
function start()
@@ -560,16 +561,10 @@ function start()
return 1
fi
- status
- rc=$?
- if [ $rc == 2 ]; then
- echo "Kdump is not supported on this kernel: [WARNING]"
- return 1;
- else
- if [ $rc == 0 ]; then
- echo "Kdump already running: [WARNING]"
- return 0
- fi
+ check_current_kdump_status
+ if [ $? == 0 ]; then
+ echo "Kdump already running: [WARNING]"
+ return 0
fi
if check_ssh_config; then
--
1.8.3.1