On Thu, Jul 17, 2014 at 12:00:43PM +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 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>
---
Looks good.
Acked-by: Vivek Goyal <vgoyal(a)redhat.com>
Thanks
Vivek
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