#!/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. # probe: true # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs # Check that networking is up. [ "${NETWORKING}" = "no" ] && echo "Error: Networking is down"; exit 0 # Sanity check [ -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 daemon rpc.mountd show Starting rpc.nfsd daemon rpc.nfsd else echo "nfs already is running" 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 rm -f /var/lock/subsys/nfs ;; status) status rpc.mountd status rpc.nfsd ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 1 esac exit 0