#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Description: To get the hostname by IP address assigend in $DRBL_SCRIPT_PATH/conf/client-ip-hostname

# Loading setting.
. /opt/drbl/conf/drbl.conf
#
export LC_ALL=C
IP=$1
[ -z "$IP" ] && exit 1
if [ -f $DRBL_SCRIPT_PATH/conf/client-ip-hostname ]; then
  grep -iEw "^[[:space:]]*${IP}" $DRBL_SCRIPT_PATH/conf/client-ip-hostname | awk -F" " '{print $2}'
fi
