#!/sbin/runscript

# By default start up 8 server threads.
: ${nfsd_args:=8}

command=/usr/sbin/rpc.nfsd
command_args=$nfsd_args
pidfile=/var/run/nfsd.pid
name="RPC Network File System daemon"

depend()
{
	use procfs
	need mountd
}

start_post()
{
	echo $(pidof -o %PPID nfsd) > $pidfile
	sm-notify ${smnotify_args}
}

stop()
{
	# Unexport all directories before.
	exportfs -au
	ebegin "Stopping $name"
		kill -9 $(cat $pidfile) && rm -f $pidfile
	eend $?
}
