3

I am trying to start iperf server in background and redirect the output to a file. But it is not working.

server:

iperf3 -s -D >> /tmp/listen.txt
            or
iperf3 -s -D > listen.txt

client:

iperf3 -c <server-ip> -B <client-ip> > send.txt

I am able to see output in send.txt on client but on server, I don't see anything being written in any file. Can someone help me with this command?

3 Answers3

4

Instead of using the daemon option, use nohup:

nohup iperf3 -s >> /tmp/listen.txt 2>&1 &

That will put iperf3 in the background and make it immune to hangups. The shell will print out the job number and PID:

$ [1] 1234

You can stop it later by sending a SIGTERM using kill:

$ kill -SIGTERM 1234
2

On any recent iperf3:

iperf3 --server --daemon --logfile iperf3.txt --pidfile iperf3.pid

(substitute short command line flags if you like)

The server output will go to the file iperf3.txt. The process ID will be stored in the file iperf3.pid...you can look that up when you want to kill the process.

If you want to be sure that output makes it to the file in a more timely manner (possibly at a very small hit to performance), add the --forceflush flag.

Bruce A. Mah
  • 386
  • 1
  • 6
0

I just run it in a screen session and use '--logfile' option to capture the output.

screen -S iperf-server
iperf3 -s -B 10.11.12.13 -p 5001 --logfile s1.txt

You can do the same for client.

Hem
  • 619
  • 13
  • 26