]> git.pld-linux.org Git - packages/nfs-utils.git/commitdiff
- unified versions for nfs-server, knfsd and nfs-utils
authorJan Rękorajski <baggins@pld-linux.org>
Tue, 30 Nov 1999 13:54:47 +0000 (13:54 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    nfs.init -> 1.7
    nfs.sysconfig -> 1.2
    nfslock.init -> 1.1
    nfslock.sysconfig -> 1.1

nfs.init
nfs.sysconfig
nfslock.init [new file with mode: 0644]
nfslock.sysconfig [new file with mode: 0644]

index 47c79f51b209639a7f255f82dff7ffd29f66d029..fbc521e971987dd82d236c81f58b990bc002fb99 100644 (file)
--- a/nfs.init
+++ b/nfs.init
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
-# nfs           This shell script takes care of starting and stopping
-#               the NFS services. Later we might add NIS too.
+# nfs          This shell script takes care of starting and stopping
+#              the NFS services.
 #
 # chkconfig:   345 60 20
 # description: NFS is a popular protocol for file sharing across TCP/IP \
@@ -9,7 +9,6 @@
 #              which is configured via the /etc/exports file.
 # probe:       true
 
-
 # Source function library
 . /etc/rc.d/init.d/functions
 
 . /etc/sysconfig/network
 
 # Get service config
-[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
+[ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd
 
 # Check that networking is up.
 if [ "${NETWORKING}" = "no" ]; then
-       echo "WARNING: Networking is down. Nfs service can't be runed."
+       echo "WARNING: Networking is down. Knfsd can't be run"
        exit 1
 fi
 
-# Sanity check
-[ -f /etc/exports ] || exit 0
+if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
+       [ -z "`/sbin/pidof portmap`" ] && echo "Error: portmap isn't running" && exit 0
+fi
 
+# Sanity checks
+[ -x /usr/sbin/rpc.nfsd ] || exit 0
+[ -x /usr/sbin/rpc.mountd ] || exit 0
+[ -f /etc/exports ] || exit 0
 
 # See how we were called.
 case "$1" in
   start)
-       # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/nfs ]; then
-               show Starting rpc.mountd
+       # Start daemons.
+       if [ NFSDTYPE = "U" ] ; then
+               show "Starting NFS mountd"
                daemon rpc.mountd
-               show Starting rpc.nfsd
+               show "Starting NFS daemon"
                daemon rpc.nfsd
        else
-               echo "nfs already is running"
+               show "Starting NFS services"
+               daemon /usr/sbin/exportfs -r
+               show "Starting NFS mountd"
+               daemon rpc.mountd $RPCMOUNTDOPTS
+               show "Starting NFS daemon"
+               daemon rpc.nfsd $RPCNFSDCOUNT
        fi
        touch /var/lock/subsys/nfs
        ;;
   stop)
        # Stop daemons.
-       show Shutting down rpc.mountd
-       killproc rpc.mountd
-       show Shutting down rpc.nfsd
-       killproc rpc.nfsd
+       if [ NFSDTYPE = "U" ] ; then
+               show "Shutting down NFS mountd"
+               killproc rpc.mountd
+               show "Shutting down NFS daemon"
+               killproc rpc.nfsd
+       else
+               show "Shutting down NFS services"
+               daemon /usr/sbin/exportfs -au
+               show "Shutting down NFS mountd"
+               killproc rpc.mountd
+               show "Shutting down NFS daemon"
+               killproc nfsd -QUIT
+       fi
        rm -f /var/lock/subsys/nfs
        ;;
   status)
        status rpc.mountd
-       status rpc.nfsd
+       if [ NFSDTYPE = "U" ] ; then
+               status rpc.nfsd
+       else
+               status nfsd
+       fi
        ;;
   restart)
-       $0 stop
-       $0 start
+       if [ NFSDTYPE = "U" ] ; then
+               $0 stop
+               $0 start
+       else
+               show "Restarting NFS services (killing)"
+               killproc rpc.mountd
+               show "Restarting NFS services (starting)"
+               daemon rpc.mountd $RPCMOUNTDOPTS
+               /usr/sbin/exportfs -r
+               touch /var/lock/subsys/nfs
+       fi
+       ;;
+  reload)
+       [ NFSDTYPE = "U" ] && exit 0
+       /usr/sbin/exportfs
+       touch /var/lock/subsys/nfs
+       ;;
+  probe)
+       [ NFSDTYPE = "U" ] && exit 0
+       if [ ! -f /var/lock/subsys/nfs ] ; then
+         echo start; exit 0
+       fi
+       /sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
+       /sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
+       if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
+         echo restart; exit 0
+       fi
+       if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
+         echo reload; exit 0
+       fi
        ;;
   *)
-       echo "Usage: $0 {start|stop|status|restart}"
+       echo "Usage: nfs {start|stop|status|restart|reload}"
        exit 1
 esac
 
 exit 0
-
index 272823079ab3950c4810eba084ca520a6cd96fb3..7f27cb356e13cc73c3a7c97622134065b6f3c7b4 100644 (file)
@@ -1,4 +1,9 @@
-# Set nice level for rpc.mountd & rpc.nfsd
+# Set nice level for rpc.mountd, rpc.nfsd or knfsd
+SERVICE_RUN_NICE_LEVEL="+0"
 
-# Define services nice level
-SERVICE_RUN_NICE_LEVEL="+1"
+# Customized setings for knfsd
+RPCMOUNTOPTIONS="--no-nfs-version 3"
+RPCNFSDCOUNT=8
+
+# Server type we are running, U for userland NFSD, K for knfsd
+NFSDTYPE=
diff --git a/nfslock.init b/nfslock.init
new file mode 100644 (file)
index 0000000..ac84672
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# nfslock       This shell script takes care of starting and stopping
+#               the NFS file locking service.
+#
+# chkconfig:   345 61 19
+# description: NFS is a popular protocol for file sharing across \
+#              TCP/IP networks. This service provides NFS file \
+#              locking functionality.
+# probe: true
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+[ -f /etc/sysconfig/nfslock ] && . /etc/sysconfig/nfslock
+
+# Check that networking is up.
+if [ "${NETWORKING}" = "no" ]; then
+       echo "WARNING: Networking is down. NFS lockd and statd can't be run"
+       exit 1
+fi
+
+if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
+       [ -z "`/sbin/pidof portmap`" ] && echo "Error: portmap isn't running" && exit 0
+fi
+
+# Sanity checks
+[ -x /usr/sbin/rpc.lockd ] || exit 0
+[ -x /usr/sbin/rpc.statd ] || exit 0
+
+# See how we were called.
+case "$1" in
+  start)
+       # Start daemons.
+       show "Starting NFS lockd"
+       daemon rpc.lockd
+       show "Starting NFS statd"
+       daemon rpc.statd
+       touch /var/lock/subsys/nfslock
+       ;;
+  stop)
+       # Stop daemons.
+       show "Shutting down NFS lockd"
+       killproc lockd
+       show "Shutting down NFS statd"
+       killproc rpc.statd
+       rm -f /var/lock/subsys/nfslock
+       ;;
+  status)
+       status lockd
+       status rpc.statd
+       ;;
+  restart)
+       $0 stop
+       $0 start
+       ;;
+  probe)
+       if [ ! -f /var/lock/subsys/nfslock ] ; then
+         echo start; exit 0
+       fi
+       /sbin/pidof rpc.statd >/dev/null 2>&1; STATD="$?"
+       /sbin/pidof lockd >/dev/null 2>&1; LOCKD="$?"
+       if [ $STATD = 1 -o $LOCKD = 1 ] ; then
+         echo restart; exit 0
+       fi
+       ;;
+  *)
+       echo "Usage: nfslock {start|stop|status|restart}"
+       exit 1
+esac
+
+exit 0
diff --git a/nfslock.sysconfig b/nfslock.sysconfig
new file mode 100644 (file)
index 0000000..cf19fd0
--- /dev/null
@@ -0,0 +1,3 @@
+# Define nice level for knfslock daemons
+SERVICE_RUN_NICE_LEVEL="+0"
+
This page took 0.109302 seconds and 4 git commands to generate.