#!/bin/sh
if [ $# -gt 0 ]
then
	sleep "$1"
fi

NFSDIR=/home/tron
if [ -d $NFSDIR ]
then
	echo "Directory \"$NFSDIR\" exists."
	exit 1
fi

killall lookupd
sleep 1
killall -HUP automount
sleep 2

if [ ! -d $NFSDIR ]
then
	echo "Directory \"$NFSDIR\" still doesn't exists, retrying."

	sleep 10
	killall lookupd
	sleep 1
	killall -HUP automount
	sleep 2
	if [ ! -d $NFSDIR ]

	then
		echo "Directory \"$NFSDIR\" still doesn't exists, giving up"
		exit 1
	fi
fi

echo "Fixed NIS."
exit 0
