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.
|
|
|
|
|
|
|
|
[ -x /usr/sbin/rpc.statd ] || exit 0
|
|
|
|
[ -x /usr/sbin/rpc.nfsd ] || exit 0
|
|
|
|
[ -x /usr/sbin/rpc.mountd ] || exit 0
|
|
|
|
[ -x /usr/sbin/exportfs ] || exit 0
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
touch /var/lock/subsys/nfslock
|
|
|
|
echo "done"
|
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NFS services: "
|
2007-01-14 02:46:04 +01:00
|
|
|
/usr/sbin/exportfs -r
|
|
|
|
echo "done"
|
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NFS daemon: "
|
2007-01-14 02:46:04 +01:00
|
|
|
rpc.nfsd 2
|
|
|
|
echo "done"
|
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NFS mountd: "
|
2007-01-14 02:46:04 +01:00
|
|
|
rpc.mountd
|
|
|
|
echo "done"
|
|
|
|
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: "
|
2007-01-14 02:46:04 +01:00
|
|
|
killall -q rpc.mountd
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
echo "Shutting down NFS daemon: "
|
|
|
|
kill -9 `pidof nfsd` 2>/dev/null
|
|
|
|
echo "done"
|
|
|
|
|
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
|
|
|
|
rm -f /var/lock/subsys/nfs
|
|
|
|
killall -q rpc.statd
|
|
|
|
echo "done"
|
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Stopping NFS statd: "
|
2007-01-14 02:46:04 +01:00
|
|
|
killall -q rpc.statd
|
|
|
|
echo "done"
|
|
|
|
rm -f /var/lock/subsys/nfslock
|
2007-05-07 05:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
2007-01-14 02:46:04 +01:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
/usr/sbin/exportfs -r
|
|
|
|
touch /var/lock/subsys/nfs
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: nfs {start|stop|reload}"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|