#!/bin/sh
#
# portmap -- start or stop the RPC portmapper.
#

case "$1" in
start)
    need network

    if [ -x /usr/sbin/portmap ]; then
	echo "starting RPC portmapper"
	/usr/sbin/portmap
    fi
    ;;
stop)
    # if someone hand-mounted any NFS directories, unmount them
    # now.
    /etc/rc.d/init.d/nfs stop

    if killall -0 portmap; then
	echo "stopping RPC portmapper"
	killall portmap
    fi
    ;;
*)
    echo "usage: $0 {start|stop}"
    ;;
esac
