84 lines
1.5 KiB
Plaintext
84 lines
1.5 KiB
Plaintext
|
#!/bin/sh
|
||
|
#
|
||
|
# nfs This shell script takes care of starting and stopping
|
||
|
# the NFS services. Stolen from RedHat FC5.
|
||
|
|
||
|
mkdir -p /var/lock/subsys
|
||
|
mkdir -p /run/nfs/sm
|
||
|
mkdir -p /run/nfs/sm.bak
|
||
|
touch /run/nfs/rmtab
|
||
|
|
||
|
CFG_FILE=/etc/default/nfsd
|
||
|
|
||
|
NR_THREADS=2
|
||
|
if [ -f "${CFG_FILE}" ]; then
|
||
|
. "${CFG_FILE}"
|
||
|
fi
|
||
|
|
||
|
|
||
|
start() {
|
||
|
# Start daemons.
|
||
|
printf "Starting NFS statd: "
|
||
|
rpc.statd
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
touch /var/lock/subsys/nfslock
|
||
|
|
||
|
printf "Starting NFS services: "
|
||
|
/usr/sbin/exportfs -r
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
|
||
|
printf "Starting NFS daemon: "
|
||
|
rpc.nfsd ${NR_THREADS}
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
|
||
|
printf "Starting NFS mountd: "
|
||
|
rpc.mountd
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
touch /var/lock/subsys/nfs
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
# Stop daemons.
|
||
|
printf "Shutting down NFS mountd: "
|
||
|
killall -q rpc.mountd 2>/dev/null
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
|
||
|
printf "Shutting down NFS daemon: "
|
||
|
killall -q nfsd 2>/dev/null
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
|
||
|
printf "Shutting down NFS services: "
|
||
|
/usr/sbin/exportfs -au
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
|
||
|
printf "Stopping NFS statd: "
|
||
|
killall -q rpc.statd 2>/dev/null
|
||
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||
|
rm -f /var/lock/subsys/nfs
|
||
|
rm -f /var/run/rpc.statd.pid
|
||
|
rm -f /var/lock/subsys/nfslock
|
||
|
}
|
||
|
|
||
|
# See how we were called.
|
||
|
case "$1" in
|
||
|
start)
|
||
|
start
|
||
|
;;
|
||
|
stop)
|
||
|
stop
|
||
|
;;
|
||
|
restart)
|
||
|
stop
|
||
|
start
|
||
|
;;
|
||
|
reload)
|
||
|
/usr/sbin/exportfs -r
|
||
|
touch /var/lock/subsys/nfs
|
||
|
;;
|
||
|
*)
|
||
|
echo "Usage: $0 {start|stop|restart|reload}"
|
||
|
exit 1
|
||
|
esac
|
||
|
|
||
|
exit 0
|