3 # nfs-common This shell script takes care of starting and stopping
4 # common daemons required for NFS clients and servers.
7 # description: NFS is a popular protocol for file sharing across \
8 # TCP/IP networks. This service provides NFS file \
9 # locking functionality.
15 DESC="NFS common utilities"
18 DEFAULTFILE=/etc/default/nfs-common
21 if [ -f $DEFAULTFILE ]; then
25 # Determine whether lockd is required
28 *) # We must be conservative and run lockd,
29 # unless we can prove that it's not required.
31 if test -f /proc/ksyms
33 grep -q lockdctl /proc/ksyms || NEED_LOCKD=no
38 # Exit if required binaries are missing.
39 [ -x $PREFIX/sbin/rpc.statd ] || exit 0
40 [ -x $PREFIX/sbin/rpc.lockd ] || [ "$NEED_LOCKD" = no ] || exit 0
42 # See how we were called.
45 cd / # daemons should have root dir as cwd
46 printf "Starting $DESC:"
48 start-stop-daemon --start --quiet \
49 --exec $PREFIX/sbin/rpc.statd -- $STATDOPTS
50 if [ "$NEED_LOCKD" = yes ]
53 start-stop-daemon --start --quiet \
54 --exec $PREFIX/sbin/rpc.lockd || true
60 printf "Stopping $DESC:"
61 if [ "$NEED_LOCKD" = yes ]
64 start-stop-daemon --stop --oknodo --quiet \
65 --name rpc.lockd --user 0 || true
68 start-stop-daemon --stop --oknodo --quiet \
69 --name rpc.statd --user 0
73 restart | force-reload)
80 echo "Usage: nfs-common {start|stop|restart}"