On Wed, Jul 16, 2014 at 08:18:21PM +0800, WANG Chao wrote:
Vivek suggested we should display message while waiting for the
lock,
because the waiting could be long and user will have no idea what's
going on.
So we will repeat the following message every 5 seconds while waiting:
Another kdump instance is hoding the lock;
Waiting for it to exit...
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdumpctl | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 9cae0c4..5b5bb83 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -20,8 +20,20 @@ fi
single_instance_lock()
{
+ local rc timeout=5
+
exec 9>/var/lock/kdump
- flock 9
+
+ flock -n 9
+ rc=$?
+
+ while [ $rc -ne 0 ]; do
+ echo "Another kdump instance is hoding the lock;"
+ echo "Waiting for it to exit..."
Hi Chao,
I am not sure that term "kdump instance" brings lot of clarity there.
I see following in yum.
Another app is currently holding the yum lock; waiting for it to exit...
How about using the same string.
"Another app is currently holding the kdump lock; waiting for it to exit..."
And should be able to keep whole thing on signle line.
Thanks
Vivek