Till Westmann | 276bbc2 | 2013-06-05 18:56:27 -0700 | [diff] [blame] | 1 | #/* |
Ian Maxon | d885779 | 2015-09-11 14:19:53 -0700 | [diff] [blame] | 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | #*/ |
vinayakb | 5d8a2f2 | 2013-01-29 19:45:44 +0000 | [diff] [blame] | 19 | #get the OS |
| 20 | OS_NAME=`uname -a|awk '{print $1}'` |
| 21 | LINUX_OS='Linux' |
| 22 | |
| 23 | if [ $OS_NAME = $LINUX_OS ]; |
| 24 | then |
| 25 | #Get IP Address |
| 26 | IPADDR=`/sbin/ifconfig eth0 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'` |
Michael Blow | d6cf641 | 2016-06-30 02:44:35 -0400 | [diff] [blame] | 27 | if [ "$IPADDR" = "" ] |
buyingyi | a880ed9 | 2013-03-14 22:44:32 +0000 | [diff] [blame] | 28 | then |
Michael Blow | d6cf641 | 2016-06-30 02:44:35 -0400 | [diff] [blame] | 29 | IPADDR=`/sbin/ifconfig em1 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'` |
| 30 | fi |
| 31 | if [ "$IPADDR" = "" ] |
vinayakb | 5d8a2f2 | 2013-01-29 19:45:44 +0000 | [diff] [blame] | 32 | then |
Michael Blow | d6cf641 | 2016-06-30 02:44:35 -0400 | [diff] [blame] | 33 | IPADDR=`/sbin/ifconfig lo | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'` |
| 34 | fi |
vinayakb | 5d8a2f2 | 2013-01-29 19:45:44 +0000 | [diff] [blame] | 35 | else |
| 36 | IPADDR=`/sbin/ifconfig en1 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'` |
Michael Blow | d6cf641 | 2016-06-30 02:44:35 -0400 | [diff] [blame] | 37 | if [ "$IPADDR" = "" ] |
vinayakb | 5d8a2f2 | 2013-01-29 19:45:44 +0000 | [diff] [blame] | 38 | then |
| 39 | IPADDR=`/sbin/ifconfig lo0 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'` |
| 40 | fi |
| 41 | |
| 42 | fi |
| 43 | echo $IPADDR |