kumquat-buildroot/package/nfs-utils/S60nfs
Carlos Santos 089e1fe414 nfs-utils: don't test if the binary exists in the init script
The test doesn't make sense. It just exits without any error if the
binary doesn't exist, which is silly.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-04-16 07:34:50 +02:00

84 lines
1.5 KiB
Bash
Executable File

#!/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