#!/bin/sh # # nfs This shell script takes care of starting and stopping # the NFS services. Later we might add NIS too. # # chkconfig: 345 60 20 # description: NFS is a popular protocol for file sharing across TCP/IP \ # networks. This service provides NFS server functionality, \ # which is configured via the /etc/exports file. # # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. if [ ! -f /etc/sysconfig/network ]; then exit 0 fi . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -f /usr/sbin/rpc.nfsd ] || exit 0 [ -f /usr/sbin/rpc.mountd ] || exit 0 [ -f /etc/exports ] || exit 0 # See how we were called. case "$1" in start) # Start daemons. echo -n "Starting NFS services: " daemon rpc.mountd daemon rpc.nfsd echo touch /var/lock/subsys/nfs ;; stop) # Stop daemons. echo -n "Shutting down NFS services: " killproc rpc.mountd killproc rpc.nfsd echo rm -f /var/lock/subsys/nfs ;; status) status rpc.mountd status rpc.nfsd ;; restart) echo -n "Restarting NFS services: " echo -n "rpc.nfsd " killall -HUP rpc.nfsd echo -n "rpc.mountd " killall -HUP rpc.mountd echo "done." ;; *) echo "Usage: nfs {start|stop|status|restart}" exit 1 esac exit 0