2009-03-14 02:16:07 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# PROVIDE: nfsd
|
|
|
|
# REQUIRE: mountd
|
2009-03-28 11:27:08 +01:00
|
|
|
# KEYWORD: shutdown
|
2009-03-14 02:16:07 +01:00
|
|
|
|
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
|
|
|
|
|
|
|
name="nfsd"
|
|
|
|
rcvar=$name
|
|
|
|
command="/usr/sbin/rpc.nfsd"
|
2009-03-28 11:27:08 +01:00
|
|
|
start_cmd="nfsd_start_cmd"
|
|
|
|
stop_cmd="nfsd_stop_cmd"
|
|
|
|
status_cmd="nfsd_status_cmd"
|
|
|
|
pidfile="/var/run/${name}.pid"
|
2009-03-14 02:16:07 +01:00
|
|
|
|
2009-03-28 11:27:08 +01:00
|
|
|
nfsd_start_cmd()
|
2009-03-14 02:16:07 +01:00
|
|
|
{
|
2009-03-28 11:27:08 +01:00
|
|
|
#
|
|
|
|
# Load the nfsd module to make the mount call
|
|
|
|
# succeed.
|
|
|
|
#
|
|
|
|
modprobe -q nfsd
|
|
|
|
|
|
|
|
#
|
|
|
|
# By default start up 8 threads.
|
|
|
|
#
|
|
|
|
[ -z "${nfsd_flags}" ] && nfsd_flags="8"
|
|
|
|
|
|
|
|
# Check for /proc/fs/nfsd
|
|
|
|
if grep -qs nfsd /proc/filesystems ; then
|
|
|
|
if ! grep -qs "nfsd /proc/fs/nfsd" /proc/mounts ; then
|
|
|
|
mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
${command} ${nfsd_flags}
|
|
|
|
echo $(pidof -o %PPID ${name}) > ${pidfile}
|
|
|
|
echo "Starting ${name}."
|
|
|
|
|
2009-03-14 02:16:07 +01:00
|
|
|
/usr/sbin/sm-notify ${smnotify_args}
|
|
|
|
}
|
|
|
|
|
2009-03-28 11:27:08 +01:00
|
|
|
nfsd_stop_cmd()
|
|
|
|
{
|
|
|
|
#
|
|
|
|
# Unexport all directories before.
|
|
|
|
#
|
|
|
|
exportfs -au
|
|
|
|
|
|
|
|
if [ -f ${pidfile} ]; then
|
|
|
|
PID=$(cat ${pidfile})
|
|
|
|
kill ${PID}
|
|
|
|
rm -f ${pidfile}
|
|
|
|
fi
|
|
|
|
echo "Stopped ${name}."
|
|
|
|
}
|
|
|
|
|
|
|
|
nfsd_status_cmd()
|
|
|
|
{
|
|
|
|
if [ ! -f ${pidfile} ]; then
|
|
|
|
echo "${name} is not running."
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
PID=$(cat ${pidfile})
|
|
|
|
echo "${name} is running with PIDs: ${PID}"
|
|
|
|
}
|
|
|
|
|
2009-03-14 02:16:07 +01:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|