Forwarding to BLFS Support with comments.
Walter Webb wrote:
I am not trying to be a nuisance; but since I have spent several days
getting nfs to work, I thought my conclusions would be useful.
Rearranging the nfs-server script itself is trivial, but somebody
will have to make a couple of decisions:
1: will kernels older than 2.6 be supported?
No.
2: Will nfs-utils-1.1.x be supported?
Not in the current book. Probably never.
If older kernels will not be supported, the kernel tests can be removed.
If the older nfs-utils will not be supported, the mount command can be
eliminated; but not the umount command. Other than these
considerations, only a little rearrangement is necessary.
The following assumes that the older kernels and nfs-utils will be
supported. I am not aware of any other considerations of sequence
of execution than mount and rpc.mountd, so things will be kept in the
same sequence as much as possible.
This is based on the 2012-04-04 16:37:48 script.
This is my recommended case statement.
Hmm, OK. I can see removing the mount command and the test for the umount
command. I don't see any other changes. Attached is proposed version.
It's interesting to note that the mount command doesn't run for LFS 7.0 an later
since the kernel is 3.x.
-- Bruce
-----------------------------------------------------------------------------------------------------------------
case "$1" in
start) log_info_msg "Starting NFS statd..."
start_daemon /usr/sbin/rpc.statd
evaluate_retval
# NFSD support in 2.6 and later kernels
# not needed for newer nfs-utils, but ok
# must not be run after rpc.nfsd
/bin/uname -r | /bin/grep -E "^2.6|^3" 2>&1 > /dev/null
if [ $? = 0 ]; then
log_info_msg "Mounting nfsd virtual filesystem..."
/bin/mount -t nfsd none /proc/fs/nfsd 2>&1 > /dev/null
evaluate_retval
fi
log_info_msg "Starting NFS nfsd..."
start_daemon /usr/sbin/rpc.nfsd -p $PORT $PROCESSES
evaluate_retval
if [ "$QUOTAS" = "yes" ]; then
log_info_msg "Starting NFS rquotad..."
start_daemon /usr/sbin/rpc.rquotad
evaluate_retval
fi
# /proc/fs/nfsd must already be mounted
log_info_msg "Starting NFS mountd..."
start_daemon /usr/sbin/rpc.mountd
evaluate_retval
# Make certain that the list is refreshed on a restart.
log_info_msg "Exporting NFS Filesystems..."
/usr/sbin/exportfs -ra 2>&1 > /dev/null
evaluate_retval
;;
stop)
log_info_msg "Removing NFS Exported Filesystems..."
/usr/sbin/exportfs -au 2>&1 > /dev/null
evaluate_retval
# NFSD support in 2.6 and later kernels
/bin/uname -r | /bin/grep -E "^2.6|^3" 2>&1 > /dev/null
if [ $? = 0 ]; then
log_info_msg "Unmounting NFS Virtual Filesystem..."
/bin/umount /proc/fs/nfsd 2>&1 > /dev/null
evaluate_retval
fi
# The remainder of the case statement is unchanged
if [ "$QUOTAS" = "yes" ]; then
log_info_msg "Stopping NFS rquotad..."
killproc /usr/sbin/rpc.rquotad
evaluate_retval
fi
log_info_msg "Stopping NFS statd..."
killproc /usr/sbin/rpc.statd
evaluate_retval
log_info_msg "Stopping NFS nfsd..."
# nfsd needs HUP. Can't use killproc for kernel process.
killall -HUP nfsd
evaluate_retval
log_info_msg "Stopping NFS mountd..."
killproc /usr/sbin/rpc.mountd
evaluate_retval
# Remove a pid file that isn't done automatically
if [ -f /var/run/rpc.statd.pid ]; then
log_success_msg "Removing the rpc.statd pid file if it exists"
rm -f /var/run/rpc.statd.pid
fi
;;
reload)
log_info_msg "Reloading NFS Server..."
/usr/sbin/exportfs -ra
evaluate_retval
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
statusproc /usr/sbin/rpc.mountd
## Special case for nfsd with no full path
statusproc nfsd
statusproc /usr/sbin/rpc.statd
if [ "$QUOTA" = "yes" ]; then
statusproc rpc.rquotad
fi
;;
*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
;;
esac
#!/bin/sh
########################################################################
# Begin nfs-server
#
# Description : Start nfs server
#
# Authors : Ken Moffat - [email protected]
# Bruce Dubbs - [email protected]
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: nfs-server
# Required-Start: rpcbind
# Should-Start:
# Required-Stop: rpcbind
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts the nfs server
# Description: Starts the nfs server and exports directories.
# X-LFS-Provided-By: BLFS / LFS 7.0
### END INIT INFO
. /lib/lsb/init-functions
#$LastChangedBy: ken $
#$Date: 2012-04-04 11:37:48 -0500 (Wed, 04 Apr 2012) $
. /etc/sysconfig/nfs-server
case "$1" in
start)
log_info_msg "Starting NFS statd..."
start_daemon /usr/sbin/rpc.statd
evaluate_retval
log_info_msg "Starting NFS nfsd..."
start_daemon /usr/sbin/rpc.nfsd -p $PORT $PROCESSES
evaluate_retval
if [ "$QUOTAS" = "yes" ]; then
log_info_msg "Starting NFS rquotad..."
start_daemon /usr/sbin/rpc.rquotad
evaluate_retval
fi
log_info_msg "Starting NFS mountd..."
start_daemon /usr/sbin/rpc.mountd
evaluate_retval
# Make certain that the list is refreshed on a restart.
log_info_msg "Exporting NFS Filesystems..."
/usr/sbin/exportfs -ra 2>&1 > /dev/null
evaluate_retval
;;
stop)
log_info_msg "Removing NFS Exported Filesystems..."
/usr/sbin/exportfs -au 2>&1 > /dev/null
evaluate_retval
log_info_msg "Unmounting NFS Virtual Filesystem..."
/bin/umount /proc/fs/nfsd 2>&1 > /dev/null
evaluate_retval
if [ "$QUOTAS" = "yes" ]; then
log_info_msg "Stopping NFS rquotad..."
killproc /usr/sbin/rpc.rquotad
evaluate_retval
fi
log_info_msg "Stopping NFS statd..."
killproc /usr/sbin/rpc.statd
evaluate_retval
log_info_msg "Stopping NFS nfsd..."
# nfsd needs HUP. Can't use killproc for kernel process.
killall -HUP nfsd
evaluate_retval
log_info_msg "Stopping NFS mountd..."
killproc /usr/sbin/rpc.mountd
evaluate_retval
# Remove a pid file that isn't done automatically
if [ -f /var/run/rpc.statd.pid ]; then
log_success_msg "Removing the rpc.statd pid file if it exists"
rm -f /var/run/rpc.statd.pid
fi
;;
reload)
log_info_msg "Reloading NFS Server..."
/usr/sbin/exportfs -ra
evaluate_retval
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
statusproc /usr/sbin/rpc.mountd
## Special case for nfsd with no full path
statusproc nfsd
statusproc /usr/sbin/rpc.statd
if [ "$QUOTA" = "yes" ]; then
statusproc rpc.rquotad
fi
;;
*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
;;
esac
# End /etc/init.d/nfs-server
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page