2013-09-09 17:17:36

by Harshula

[permalink] [raw]
Subject: [PATCH] nfsiostat: periodically flush stdout

* In a shell script, when nfsiostat is run in the background with
stdout redirected to a file, flush stdout periodically to ensure
that we do not lose the buffered output if the nfsiostat process
is killed.

Signed-off-by: Harshula Jayasuriya <[email protected]>
---
tools/nfs-iostat/nfs-iostat.py | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
index c035537..155581c 100644
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -413,6 +413,8 @@ class DeviceData:
self.__print_rpc_op_stats('WRITE', sample_time)
self.__print_page_stats(sample_time)

+ sys.stdout.flush()
+
#
# Functions
#
--
1.8.3.1



2013-09-18 19:15:26

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] nfsiostat: periodically flush stdout



On 09/09/13 13:17, Harshula Jayasuriya wrote:
> * In a shell script, when nfsiostat is run in the background with
> stdout redirected to a file, flush stdout periodically to ensure
> that we do not lose the buffered output if the nfsiostat process
> is killed.
>
> Signed-off-by: Harshula Jayasuriya <[email protected]>
Committed!

steved.

> ---
> tools/nfs-iostat/nfs-iostat.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
> index c035537..155581c 100644
> --- a/tools/nfs-iostat/nfs-iostat.py
> +++ b/tools/nfs-iostat/nfs-iostat.py
> @@ -413,6 +413,8 @@ class DeviceData:
> self.__print_rpc_op_stats('WRITE', sample_time)
> self.__print_page_stats(sample_time)
>
> + sys.stdout.flush()
> +
> #
> # Functions
> #
>