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 app is currently holding the kdump lock; waiting for it to exit..."
Thanks Vivek for providing a more comprehensive message.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdumpctl | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 9cae0c4..0025620 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -20,8 +20,18 @@ 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 app is currently holding the kdump lock; waiting for it to
exit..."
+ flock -w $timeout 9
+ rc=$?
+ done
}
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ...
[<paramN>]
--
1.9.3
Show replies by date