mirror of
git://slackware.nl/current.git
synced 2024-12-28 09:59:53 +01:00
646a5c1cbf
a/pkgtools-15.0-noarch-13.txz: Rebuilt. installpkg: default line length for --terselength is the number of columns. removepkg: added --terse mode. upgradepkg: default line length for --terselength is the number of columns. upgradepkg: accept -option in addition to --option. ap/vim-8.1.0026-x86_64-1.txz: Upgraded. d/bison-3.0.5-x86_64-1.txz: Upgraded. e/emacs-26.1-x86_64-1.txz: Upgraded. kde/kopete-4.14.3-x86_64-8.txz: Rebuilt. Recompiled against libidn-1.35. n/conntrack-tools-1.4.5-x86_64-1.txz: Upgraded. n/libnetfilter_conntrack-1.0.7-x86_64-1.txz: Upgraded. n/libnftnl-1.1.0-x86_64-1.txz: Upgraded. n/links-2.16-x86_64-2.txz: Rebuilt. Rebuilt to enable X driver for -g mode. n/lynx-2.8.9dev.19-x86_64-1.txz: Upgraded. n/nftables-0.8.5-x86_64-1.txz: Upgraded. n/p11-kit-0.23.11-x86_64-1.txz: Upgraded. n/ulogd-2.0.7-x86_64-1.txz: Upgraded. n/whois-5.3.1-x86_64-1.txz: Upgraded. xap/network-manager-applet-1.8.12-x86_64-1.txz: Upgraded. xap/vim-gvim-8.1.0026-x86_64-1.txz: Upgraded.
115 lines
2.9 KiB
Bash
115 lines
2.9 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
|
|
|
|
# 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
|