+++ /dev/null
-#!/bin/sh
-# nfs This shell script starts and stops the nfs services in a distribution
-# independent fashion.
-#
-# description: starts and stops nfs client services
-# chkconfig: 2345 60 86
-#
-# Copyright (c) 2000-2001 Mission Critical Linux, Inc.
-#
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-export PATH
-
-# Who am I?
-SCRIPT_NAME=`basename $0`
-
-# Grab our daemon functions.
-. `dirname $0`/nfs-functions
-
-# Kernel daemons and options
-PREFIX="rpc." # Prefix for kernel execs (usually "rpc.")
-LOCKD="lockd" # Lockd
-
-# User daemons and options
-STATD="rpc.statd" # NLM Server
-
-# We use "type -path" instead of "which" since it's internal to bash.
-[ -x "`type -path $STATD`" ] || exit 0
-[ -x "`type -path $PREFIX$LOCKD`" ] || exit 0
-
-# Handle how we were called.
-case "$1" in
-start)
- # Start rpc.statd daemon without options...
- echo -n "Starting $STATD: "
- startdaemon $STATD
-
- echo -n "Starting $LOCKD: "
- startdaemon $PREFIX$LOCKD
-
- # if this lock file doesn't exist, init won't even try to run
- # the shutdown script for this service on RedHat systems!
- # on non-RedHat systems, /var/lock/subsys may not exist.
- touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
- ;;
-
-stop)
- echo -n "Stopping $STATD: "
- stopdaemon $STATD
-
- echo -n "Stopping $LOCKD: "
- stopdaemon $LOCKD
-
- rm -f /var/lock/subsys/$SCRIPT_NAME
- ;;
-
-restart)
- $0 stop
- $0 start
- ;;
-
-status)
- daemonstatus $STATD
- daemonstatus $LOCKD
-
- exit 0
- ;;
-
-*)
- echo "Usage: $0 {start|stop|status|restart}"
- exit 1
-esac
-
-exit 0
+++ /dev/null
-#!/bin/bash
-#
-# An attempt at a simple, distribution-independent daemon management.
-#
-# Copyright (C) 2000-2001 Mission Critical Linux, Inc.
-#
-
-# daemon functions
-getpid()
-{
- pid=''
- if [ -f /var/run/${base}.pid ]
- then
- pid=`head -1 /var/run/${base}.pid`
- fi
- if [ "$pid" = "" ]
- then
- pid=`pidof $1`
- fi
- if [ "$pid" = "" ]
- then
- pid=`ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
- { if ((prog == $5) || (("(" prog ")") == $5) ||
- (("[" prog "]") == $5) ||
- ((prog ":") == $5)) { print $1 ; exit 0 } }' $1`
- fi
-
- echo $pid
-}
-
-startdaemon()
-{
- base=`basename $1`
-
- # check if it is already running
- pid=`getpid $base`
- [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && echo " already running." && return
-
- # don't dump core
- ulimit -c 0
-
- $* && echo " done." || echo " failed."
-}
-
-stopdaemon()
-{
- base=`basename $1`
- pid=`getpid $base`
-
- if [ "$pid" != "" ]
- then
- if ps h $pid>/dev/null 2>&1
- then
- kill -TERM $pid
- if ps h $pid>/dev/null 2>&1
- then
- sleep 1
- if ps h $pid>/dev/null 2>&1
- then
- sleep 3
- if ps h $pid>/dev/null 2>&1
- then
- kill -KILL $pid
- sleep 2
- fi
- fi
- fi
- fi
- ps h $pid >/dev/null 2>&1
- RC=$?
- [ $RC -eq 0 ] && echo " failed." || echo " done."
- [ $RC -eq 0 ] || rm -f /var/run/$base.pid >/dev/null 2>&1
- else
- echo " not running."
- fi
-}
-
-daemonstatus()
-{
- base=`basename $1`
- pid=`getpid $base`
-
- if [ "$pid" != "" ]
- then
- if ps h $pid >/dev/null 2>&1
- then
- echo "$base (pid $pid) is running."
- return 0
- else
- if [ -f /var/run/${base}.pid ]
- then
- echo "$base dead but pid file exists."
- return 1
- else
- echo "$base is stopped."
- return 2
- fi
- fi
- else
- echo "$base is stopped."
- return 3
- fi
-}
-
+++ /dev/null
-#!/bin/sh
-# nfs This shell script starts and stops the nfs services in a distribution
-# independent fashion.
-#
-# description: starts and stops nfs server services
-# chkconfig: 2345 60 20
-#
-# Copyright (c) 2000-2001 Mission Critical Linux, Inc.
-#
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-export PATH
-
-# Who am I?
-SCRIPT_NAME=`basename $0`
-
-# Grab our daemon functions.
-. `dirname $0`/nfs-functions
-
-# Kernel daemons and options
-PREFIX="rpc." # Prefix for kernel execs (usually "rpc.")
-NFSD="nfsd" # Kernel NFS Server
-RPCNFSDCOUNT="8" # Number of nfsd threads
-
-# User daemons and options
-RQUOTAD="rpc.rquotad" # Remote quota server
-MOUNTD="rpc.mountd" # Mount server
-RPCMOUNTDOPTS="" # options for rpc.mountd
-EXPORTFS="exportfs" # Exportfs command
-
-SCRIPT_NAME=`basename $0`
-DESC="NFS kernel daemon"
-
-# We use "type -path" instead of "which" since it's internal to bash.
-[ -x "`type -path $PREFIX$NFSD`" ] || exit 0
-[ -x "`type -path $MOUNTD`" ] || exit 0
-
-# Also make sure we have our exportfs command.
-[ -x "`type -path $EXPORTFS`" ] || exit 0
-[ -s /etc/exports ] || exit 0
-
-# rquotad is not required for NFS to work, however.
-# Unset if it is not present.
-[ -x "`type -path $RQUOTAD`" ] || unset RQUOTAD
-
-# Handle how we were called.
-case "$1" in
-start)
- if [ -d /proc/fs/nfsd -a ! -f /proc/fs/nfsd/exports ] ;
- then
- /bin/mount -t nfsd nfsd /proc/fs/nfsd
- fi
- echo -n "Exporting directories for $DESC..."
- $EXPORTFS -r
- echo "done."
-
- echo -n "Starting $NFSD: "
- startdaemon $PREFIX$NFSD $RPCNFSDCOUNT
-
- # Disable NFSv3 on mountd if we don't have NFSv3
- ClearAddr=
- if [ -f /proc/net/rpc/auth.unix.ip/channel ] ; then
- if grep -s 127.0.0.1 /proc/net/rpc/auth.unix.ip/content > /dev/null ; then
- : address already known
- else
- echo nfsd 127.0.0.1 2147483647 localhost > /proc/net/rpc/auth.unix.ip/channel
- ClearAddr=
- fi
- fi
- rpcinfo -u localhost nfs 3 &>/dev/null
- if [ "$?" != "0" ]
- then
- RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3"
- fi
- if [ -n "$ClearAddr" ]; then
- echo nfsd 127.0.0.1 1 > /proc/net/rpc/auth.unix.ip/channel
- fi
-
- echo -n "Starting $MOUNTD: "
- startdaemon $MOUNTD $RPCMOUNTDOPTS
-
- # Start rquotad if it is set
- if [ -n "$RQUOTAD" ]
- then
- echo -n "Starting $RQUOTAD: "
- startdaemon $RQUOTAD
- fi
-
- # if this lock file doesn't exist, init won't even try to run
- # the shutdown script for this service on RedHat systems!
- # on non-RedHat systems, /var/lock/subsys may not exist.
- touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
- ;;
-
-stop)
- for process in $RQUOTAD $MOUNTD $NFSD
- do
- echo -n "Stopping $process: "
- stopdaemon $process
- done
-
- echo "Unexporting directories for $DESC..."
- $EXPORTFS -au
- if [ -f /proc/fs/nfsd/exports ] ; then /bin/umount -t nfsd nfsd /proc/fs/nfsd ; fi
- rm -f /var/lock/subsys/$SCRIPT_NAME
- echo "done."
- ;;
-
-restart)
- $0 stop
- sleep 1
- $0 start
- ;;
-
-reload)
- # Update exports
- echo "Re-exporting directories for $DESC..."
- $EXPORTFS -r
- touch /var/lock/subsys/$SCRIPT_NAME &> /dev/null
- echo "done."
- ;;
-
-status)
- # First, check status of userland daemons
- for process in $RQUOTAD $MOUNTD $NFSD
- do
- daemonstatus $process
- done
- exit 0
- ;;
-
-*)
- echo "Usage: $0 {start|stop|status|restart|reload}"
- exit 1
-esac