TCPKILL | Scripting mode – batch mode

TKILL_ID_SEM="/tmp/tcpkill.$(date +%s).$RANDOM"
test -f $TKILL_ID_SEM && rm -f $TKILL_ID_SEM 

tcpkill -9 host $DEAD_HOST > $TKILL_ID_SEM 2>/dev/null &

KILL_PID=$!

CNT=0; CNTLIMIT=60

while [ $CNT -lt $CNTLIMIT ]; do

#    echo $TKILL_ID_SEM

    sleep 1

    test -f $TKILL_ID_SEM && rm -f $TKILL_ID_SEM && kill -9 $KILL_PID && exit 

    CNT = $[ $CNT + 1 ]

#    echo $CNT
done

kill -9 $KILL_PID
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s