#!/bin/sh

# display a filesystem node which is remote
#
# if a gfarm file is specified as an argument, display a remote hostname
# which has a replica of the file

if	case $# in
	0)	host=`gfsched -n 1 -O -w 2>&1`;;
	1)	host=`gfsched -n 1 -O -f "$1" 2>/dev/null`;;
	*)	echo >&2 "Usage: get_remote_gfhost [<gfarm_file>]"
		exit 2;;
	esac
then
	echo $host
	exit 0
else
	exit 1
fi
