daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. check_serverip()
  2. {
  3.     ret=0
  4.     serverip=${LSERVER_FUN_IP}
  5.     seripv6=${SERVER_IPV6}
  6.     status=$(cat /sys/class/net/$1/operstate)
  7.    
  8.     if [ "$status" = "down" ];then
  9.         tst_resm TINFO "interface $1 status is down"
  10.         ret=1
  11.         return $ret
  12.     fi
  13.  
  14.     ipaddr=$(ifconfig | grep -C 2 $1 | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 | awk -F "." '{print $1}')
  15.     if [ "$ipaddr" = "10" ];then
  16.         serverip=${SERVER_FUN_IP}
  17.     elif [ "$ipaddr" = "192" ];then
  18.         serverip=${LSERVER_FUN_IP}
  19.     fi
  20.        
  21.     if [ -z "$serverip" -o -z "$seripv6" ] ;then
  22.         ret=1
  23.     fi
  24.  
  25.     return $ret
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top