#!/bin/sh # # nfs This shell script takes care of starting and stopping # the NFS services. # # chkconfig: 234 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 WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions # Source networking configuration. # Check that networking is up. SourceIfNotEmpty /etc/sysconfig/network && [ "$NETWORKING" != no ] || exit SourceIfNotEmpty /etc/sysconfig/vserver NFSD=/usr/sbin/unfsd EXPORTFS=/usr/sbin/exportfs EXPORTS=/etc/exports [ -x "$NFSD" ] || exit SourceIfNotEmpty /etc/sysconfig/nfs SourceIfNotEmpty /etc/syscongig/unfs3 LOCKFILE=/var/lock/subsys/nfs RETVAL=0 start() { # Don't start anything when exports is empty [ -s "$EXPORTS" ] || return # nfsd action $"Starting NFS daemon: " $NFSD $UNFS_OPTS RETVAL=$? [ $RETVAL -eq 0 ] || return touch "$LOCKFILE" return $RETVAL } stop() { # Stop daemons. msg_stopping $"NFS daemon" stop_daemon --no-announce -- $NFSD # Do it the last so that clients can still access the server # when the server is running. RETVAL=$? [ $RETVAL -eq 0 ] && rm -f "$LOCKFILE" return $RETVAL } restart() { stop start } reload() { action "Reexporting NFS file systems:" kill -SIGHUP $NFSD RETVAL=$? [ $RETVAL -eq 0 ] && touch "$LOCKFILE" return $RETVAL } statuses() { RETVAL=$? } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; status) statuses ;; *) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|status}" RETVAL=1 esac exit $RETVAL