1 #!/bin/sh 2 3 ################################################################################ 4 ## ## 5 ## Copyright (c) International Business Machines Corp., 2005 ## 6 ## ## 7 ## This program is free software; you can redistribute it and#or modify ## 8 ## it under the terms of the GNU General Public License as published by ## 9 ## the Free Software Foundation; either version 2 of the License, or ## 10 ## (at your option) any later version. ## 11 ## ## 12 ## This program is distributed in the hope that it will be useful, but ## 13 ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## 14 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## 15 ## for more details. ## 16 ## ## 17 ## You should have received a copy of the GNU General Public License ## 18 ## along with this program; if not, write to the Free Software ## 19 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 20 ## ## 21 ## ## 22 ################################################################################ 23 # 24 # File: 25 # killall_icmp_traffic 26 # 27 # Description: 28 # Kill all of the icmp traffic utilities (ping or ping6) 29 # 30 # Arguments: 31 # None 32 # 33 # Returns: 34 # None 35 # 36 # Author: 37 # Mitsuru Chinen <mitch (at] jp.ibm.com> 38 # 39 # History: 40 # Oct 19 2005 - Created (Mitsuru Chinen) 41 # 42 #----------------------------------------------------------------------- 43 #Uncomment line below for debug output. 44 #trace_logic=${trace_logic:-"set -x"} 45 $trace_logic 46 47 # Make sure the value of LTPROOT 48 LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`} 49 export LTPROOT 50 51 # Check the environmanet variable for the test 52 . check_envval || exit 1 53 54 # Waiting time before outputting a warning message [sec] 55 WARN_WAIT=300 56 57 58 # Send SIGINT to ping and ping6 59 $LTP_RSH $RHOST "killall -SIGINT ping ping6" >/dev/null 2>&1 60 61 # Verify the all ping utitlities are dead. 62 start_epoc=`date +%s` 63 while true ; do 64 #ret=`$LTP_RSH $RHOST 'ps auxw | fgrep -v grep | grep -l [[:blank:]]ping6*[[:blank:]] >/dev/null 2>&1 ; echo $?'` 65 ret=`$LTP_RSH $RHOST 'ps auxw | fgrep -v grep | grep -l /ping6*[[:blank:]] >/dev/null 2>&1 ; echo $?'` 66 67 if [ -z $ret ]; then 68 continue 69 fi 70 71 if [ $ret -ne 0 ]; then 72 break 73 fi 74 75 current_epoc=`date +%s` 76 elapse_epoc=`expr $current_epoc - $start_epoc` 77 if [ $elapse_epoc -ge $WARN_WAIT ]; then 78 echo "ping command is not dead over $WARN_WAIT sec" >&2 79 fi 80 81 $LTP_RSH $RHOST "killall -SIGINT ping ping6" >/dev/null 2>&1 82 sleep 1 83 done 84