0

I fire tcpkill with destination ip. Example

 tcpkill host 10.0.2.184

The problem I am facing is that, tcpkill doesn't come out after killing all tcp connection. After killing all tcp connection it waits infinitely and print following information:

tcpkill: listening on eth0 [host 10.0.2.184]

is there any batch mode or any patch , using which I can ask tcpkill to quit after closing all tcp connections.

Vivek Goel
  • 193
  • 1
  • 1
  • 7

1 Answers1

1

Here's a solution, inspired by this Stack Overflow question, that works by wrapping the command in another script:

#!/bin/bash

tcpkill host 10.0.2.184 &
sleep 7
for child in $(jobs -p); do
    echo kill "$child" && kill "$child"
done
wait $(jobs -p)