-#!/bin/sh
+#!/bin/bash
### BEGIN INIT INFO
# Provides: nfs-kernel-server
# Required-Start: $remote_fs nfs-common $portmap $time
# Required-Stop: $remote_fs nfs-common $portmap $time
+# Should-Start: $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Kernel NFS server support
do_modprobe nfsd
# See if our running kernel supports the NFS kernel server
- if ! [ -d /sys/module/nfsd ]; then
+ if ! grep -E -qs "[[:space:]]nfsd\$" /proc/filesystems; then
log_warning_msg "Not starting $DESC: no support in current kernel."
exit 0
fi
log_daemon_msg "Starting $DESC"
log_progress_msg "nfsd"
+
+ # See if portmap or rpcbind are running
+ (cat </dev/null >/dev/tcp/localhost/111) 2>/dev/null
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo
+ log_warning_msg "Not starting: portmap daemon is not running"
+ exit 0
+ fi
+
start-stop-daemon --start --oknodo --quiet \
--nicelevel $RPCNFSDPRIORITY \
--exec $PREFIX/sbin/rpc.nfsd -- $RPCNFSDCOUNT