slackware-current/source/n/nfs-utils/rc.nfsd
Patrick J Volkerding 98da285765 Mon Apr 8 20:39:32 UTC 2019
a/glibc-zoneinfo-2019a-noarch-1.txz:  Upgraded.
a/grub-2.02-x86_64-5.txz:  Rebuilt.
  Support F2FS filesystem. Thanks to Nille_kungen.
ap/cups-filters-1.22.5-x86_64-1.txz:  Upgraded.
ap/itstool-2.0.6-x86_64-1.txz:  Upgraded.
d/python-setuptools-41.0.0-x86_64-1.txz:  Upgraded.
l/gobject-introspection-1.60.1-x86_64-1.txz:  Upgraded.
l/imagemagick-6.9.10_39-x86_64-1.txz:  Upgraded.
l/libcroco-0.6.13-x86_64-1.txz:  Upgraded.
l/libnotify-0.7.8-x86_64-1.txz:  Upgraded.
n/cifs-utils-6.9-x86_64-1.txz:  Upgraded.
n/nfs-utils-2.3.3-x86_64-2.txz:  Rebuilt.
  Include recovery directory. Thanks to upnort.
n/samba-4.10.2-x86_64-1.txz:  Upgraded.
  This is a security release in order to address the following defects:
  World writable files in Samba AD DC private/ dir.
  Save registry file outside share as unprivileged user.
  For more information, see:
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-3870
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-3880
  (* Security fix *)
x/libva-2.4.1-x86_64-1.txz:  Upgraded.
x/pixman-0.38.2-x86_64-1.txz:  Upgraded.
xap/gimp-2.10.10-x86_64-1.txz:  Upgraded.
2019-04-09 08:59:45 +02:00

123 lines
3.2 KiB
Bash

#!/bin/sh
# Start/stop/restart the NFS server.
#
# This is an init script for the knfsd NFS daemons.
# To use NFS, you must first set up /etc/exports.
# See exports(5) for information on /etc/exports format.
#
# Written for Slackware Linux by Patrick J. Volkerding <volkerdi@slackware.com>.
# Source default settings:
if [ -r /etc/default/rpc ]; then
. /etc/default/rpc
fi
if [ -r /etc/default/nfs ]; then
. /etc/default/nfs
fi
nfsd_start() {
# Sanity checks. Exit if there's no /etc/exports, or if there aren't any
# shares defined in it.
if [ ! -r /etc/exports ]; then # no config file, exit:
exit
elif ! grep -v '^#' /etc/exports | grep '/' 1> /dev/null 2> /dev/null ; then
exit # no uncommented shares in /etc/exports
fi
# Without this directory the logs will complain with
# 'NFSD: Unable to end grace period'.
NFSV4RECOVERYDIR=$(cat /proc/fs/nfsd/nfsv4recoverydir)
if [ -r /proc/fs/nfsd/nfsv4recoverydir -a ! -d "$NFSV4RECOVERYDIR" ]; then
mkdir "$NFSV4RECOVERYDIR"
chown -R rpc:rpc "$NFSV4RECOVERYDIR"
fi
# If we do not detect nfsd support built into the kernel (or previously
# loaded as a module), we will try to load the nfsd.ko kernel module:
if [ ! -r /proc/1/net/rpc/nfsd ]; then
/sbin/modprobe nfsd
fi
# For kernels newer than 2.4.x, use the new way of handling nfs client requests.
if [ ! "$(/bin/uname -r | /bin/cut -f 1,2 -d .)" = "2.4" ]; then
if grep -wq nfsd /proc/filesystems 2> /dev/null ; then
if grep -vwq nfsd /proc/mounts 2> /dev/null ; then
/sbin/mount -t nfsd nfsd /proc/fs/nfs 2> /dev/null
fi
fi
fi
# If basic RPC services are not running, start them:
if ! ps axc | grep -q rpc.statd ; then
if [ -r /etc/rc.d/rc.rpc ]; then
sh /etc/rc.d/rc.rpc start
else
# Sure, we tested for rpc.statd, but this is the probable cause:
echo "FATAL: Can't start NFS server without portmap package."
sleep 5
exit 1
fi
fi
echo "Starting NFS server daemons:"
if [ -x /usr/sbin/exportfs ]; then
echo " /usr/sbin/exportfs -r"
/usr/sbin/exportfs -r
fi
if [ -x /usr/sbin/rpc.rquotad ]; then
if [ -n "$RPC_RQUOTAD_PORT" ]; then
RPC_RQUOTAD_OPTS="$RPC_RQUOTAD_OPTS -p $RPC_RQUOTAD_PORT"
fi
echo " /usr/sbin/rpc.rquotad $RPC_RQUOTAD_OPTS"
/usr/sbin/rpc.rquotad $RPC_RQUOTAD_OPTS
fi
# Start nfsd servers - 8 if not set otherwise (an old Sun standard):
if [ -x /usr/sbin/rpc.nfsd ]; then
if [ -z "$RPC_NFSD_COUNT" ]; then
RPC_NFSD_COUNT=8
fi
echo " /usr/sbin/rpc.nfsd $RPC_NFSD_OPTS $RPC_NFSD_COUNT"
/usr/sbin/rpc.nfsd $RPC_NFSD_OPTS $RPC_NFSD_COUNT
fi
if [ -x /usr/sbin/rpc.mountd ]; then
if [ -n "$RPC_MOUNTD_PORT" ]; then
RPC_MOUNTD_OPTS="$RPC_MOUNTD_OPTS -p $RPC_MOUNTD_PORT"
fi
echo " /usr/sbin/rpc.mountd $RPC_MOUNTD_OPTS"
/usr/sbin/rpc.mountd $RPC_MOUNTD_OPTS
fi
}
nfsd_stop() {
killall rpc.mountd 2> /dev/null
killall nfsd 2> /dev/null
sleep 1
killall -9 nfsd 2> /dev/null # make sure :)
killall rpc.rquotad 2> /dev/null
/usr/sbin/exportfs -au 2> /dev/null
}
nfsd_restart() {
nfsd_stop
sleep 1
nfsd_start
}
case "$1" in
'start')
nfsd_start
;;
'stop')
nfsd_stop
;;
'restart')
nfsd_restart
;;
*)
echo "usage $0 start|stop|restart"
esac