2007-01-14 02:46:04 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# nfs This shell script takes care of starting and stopping
|
|
|
|
# the NFS services. Stolen from RedHat FC5.
|
|
|
|
|
2014-09-06 15:50:39 +02:00
|
|
|
mkdir -p /var/lock/subsys
|
2015-07-11 16:48:20 +02:00
|
|
|
mkdir -p /run/nfs/sm
|
2015-07-13 16:57:12 +02:00
|
|
|
mkdir -p /run/nfs/sm.bak
|
2015-07-11 16:48:20 +02:00
|
|
|
touch /run/nfs/rmtab
|
2007-01-14 02:46:04 +01:00
|
|
|
|
2015-12-17 20:45:05 +01:00
|
|
|
CFG_FILE=/etc/default/nfsd
|
|
|
|
|
|
|
|
NR_THREADS=2
|
|
|
|
if [ -f "${CFG_FILE}" ]; then
|
2016-07-03 18:46:59 +02:00
|
|
|
. "${CFG_FILE}"
|
2015-12-17 20:45:05 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2007-05-07 05:59:04 +02:00
|
|
|
start() {
|
2007-01-14 02:46:04 +01:00
|
|
|
# Start daemons.
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NFS statd: "
|
2007-01-14 02:46:04 +01:00
|
|
|
rpc.statd
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2007-01-14 02:46:04 +01:00
|
|
|
touch /var/lock/subsys/nfslock
|
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NFS services: "
|
2007-01-14 02:46:04 +01:00
|
|
|
/usr/sbin/exportfs -r
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2007-01-14 02:46:04 +01:00
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NFS daemon: "
|
2015-12-17 20:45:05 +01:00
|
|
|
rpc.nfsd ${NR_THREADS}
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2007-01-14 02:46:04 +01:00
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NFS mountd: "
|
2007-01-14 02:46:04 +01:00
|
|
|
rpc.mountd
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2007-01-14 02:46:04 +01:00
|
|
|
touch /var/lock/subsys/nfs
|
2007-05-07 05:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2007-01-14 02:46:04 +01:00
|
|
|
# Stop daemons.
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Shutting down NFS mountd: "
|
2016-07-03 18:46:58 +02:00
|
|
|
killall -q rpc.mountd 2>/dev/null
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2007-01-14 02:46:04 +01:00
|
|
|
|
2015-12-17 20:45:05 +01:00
|
|
|
printf "Shutting down NFS daemon: "
|
2016-07-03 18:46:58 +02:00
|
|
|
killall -q nfsd 2>/dev/null
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2007-01-14 02:46:04 +01:00
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Shutting down NFS services: "
|
2007-01-14 02:46:04 +01:00
|
|
|
/usr/sbin/exportfs -au
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2007-01-14 02:46:04 +01:00
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Stopping NFS statd: "
|
2016-07-03 18:46:58 +02:00
|
|
|
killall -q rpc.statd 2>/dev/null
|
2016-02-26 12:16:13 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2016-07-03 18:46:58 +02:00
|
|
|
rm -f /var/lock/subsys/nfs
|
|
|
|
rm -f /var/run/rpc.statd.pid
|
2007-01-14 02:46:04 +01:00
|
|
|
rm -f /var/lock/subsys/nfslock
|
2007-05-07 05:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
2016-07-03 18:46:59 +02:00
|
|
|
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
|
2007-01-14 02:46:04 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|