#!/bin/sh # # init file for ClusterNFS # # chkconfig: 345 50 50 # # description: ClusterNFS server # # source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # defaults OPTIONS_NFSD="-T" OPTIONS_MNTD="-T" # Get service config [ -f /etc/sysconfig/clusternfs ] && . /etc/sysconfig/clusternfs # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down ClusterNFS exit 1 fi else exit 0 fi if [ "$1" != "stop" ]; then check_portmapper || { nls "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 RETVAL=0 #See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/clusternfs ]; then msg_starting "ClusterNFS mountd" daemon /usr/sbin/rpc.mountd $OPTIONS_MNTD RETVAL=$? if [ $RETVAL -eq 0 ]; then msg_starting "ClusterNFS daemon" daemon /usr/sbin/rpc.nfsd $OPTIONS_NFSD RETVAL=$? fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/clusternfs else msg_already_running ClusterNFS fi ;; stop) # Stop daemons. if [ -f /var/lock/subsys/clusternfs ]; then msg_stopping "ClusterNFS daemon" killproc /usr/sbin/rpc.nfsd msg_stopping "ClusterNFS mountd" killproc /usr/sbin/rpc.mountd rm -f /var/lock/subsys/clusternfs else msg_not_running ClusterNFS fi ;; status) status rpc.mountd RETVAL=$? status rpc.nfsd RET=$? [ $RETVAL -eq 0 ] && RETVAL=$RET ;; restart|force-reload) $0 stop $0 start exit $? ;; *) msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 esac exit $RETVAL