#!/bin/sh
#
# nfs -- mount or unmount network file systems
#

. /etc/rc.d/sysconfig

case "$1" in 
start)
    need portmapper

    echo -n "network file systems: "

    mount -at nfs
    echo "mounted"
    ;;

info)
    echo "Network file systems"
    ;;

stop)
    NFSDIRS=`awk '$3 ~ /nfs/ {print $2}' /etc/mtab`

    if [ "$NFSDIRS" ]; then
	echo -n "network file systems: "

	# kill all processes that are using NFS volumes
	fuser -km -HUP $NFSDIRS
	sleep 2
	fuser -km -KILL $NFSDIRS
	umount -t nfs -a

	echo "unmounted"
    fi
    ;;
*)
    echo "usage: $0 {start|stop}"
    ;;
esac
