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 daemon is required.
29 '' | [01].* | 2.[0123].* )
30 # Older kernels may or may not need a lockd daemon.
31 # We must assume they do, unless we can prove otherwise.
32 # (A false positive here results only in a harmless message.)
34 if test -f /proc/ksyms
36 grep -q lockdctl /proc/ksyms || NEED_LOCKD=no
40 *) # Modern kernels (>= 2.4) start a lockd thread automatically.
47 # Exit if required binaries are missing.
48 [ -x $PREFIX/sbin/rpc.statd ] || exit 0
49 [ -x $PREFIX/sbin/rpc.lockd ] || [ "$NEED_LOCKD" = no ] || exit 0
51 # See how we were called.
54 cd / # daemons should have root dir as cwd
55 printf "Starting $DESC:"
57 start-stop-daemon --start --quiet \
58 --exec $PREFIX/sbin/rpc.statd -- $STATDOPTS
59 if [ "$NEED_LOCKD" = yes ]
62 start-stop-daemon --start --quiet \
63 --exec $PREFIX/sbin/rpc.lockd || true
69 printf "Stopping $DESC:"
70 if [ "$NEED_LOCKD" = yes ]
73 start-stop-daemon --stop --oknodo --quiet \
74 --name rpc.lockd --user 0 || true
77 start-stop-daemon --stop --oknodo --quiet \
78 --name rpc.statd --user 0
82 restart | force-reload)
89 echo "Usage: nfs-common {start|stop|restart}"