3 # Startup script for nfs-utils
6 # The environment variable NFS_SERVERS may be set in /etc/default/nfsd
7 # Other control variables may be overridden here too
8 test -r /etc
/default
/nfsd
&& .
/etc
/default
/nfsd
10 # Location of executables:
11 test -x "$NFS_MOUNTD" || NFS_MOUNTD
=/usr
/sbin
/rpc.mountd
12 test -x "$NFS_NFSD" || NFS_NFSD
=/usr
/sbin
/rpc.nfsd
13 test -x "$NFS_STATD" || NFS_STATD
=/usr
/sbin
/rpc.statd
15 # The user mode program must also exist (it just starts the kernel
16 # threads using the kernel module code).
17 test -x "$NFS_MOUNTD" ||
exit 0
18 test -x "$NFS_NFSD" ||
exit 0
20 # Default is 8 threads, value is settable between 1 and the truely
22 test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS
=8
24 # The default state directory is /var/lib/nfs
25 test -n "$NFS_STATEDIR" || NFS_STATEDIR
=/var
/lib
/nfs
27 #----------------------------------------------------------------------
28 # Startup and shutdown functions.
29 # Actual startup/shutdown is at the end of this file.
32 echo -n 'creating NFS state directory: '
33 mkdir
-p "$NFS_STATEDIR"
42 for file in xtab etab smtab rmtab
54 echo -n 'starting mountd: '
55 start-stop-daemon
--start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@"
59 echo -n 'stopping mountd: '
60 start-stop-daemon
--stop --quiet --exec "$NFS_MOUNTD"
66 echo -n "starting $1 nfsd kernel threads: "
67 start-stop-daemon
--start --exec "$NFS_NFSD" -- "$@"
71 for delay
in 0 1 2 3 4 5 6 7 8 9
73 if pidof nfsd
>/dev
/null
84 # WARNING: this kills any process with the executable
86 echo -n 'stopping nfsd: '
87 start-stop-daemon
--stop --quiet --signal 1 --name nfsd
90 echo ' using signal 9: '
91 start-stop-daemon
--stop --quiet --signal 9 --name nfsd
96 # This will remove, recursively, dependencies
97 echo -n 'removing nfsd kernel module: '
111 echo -n "starting statd: "
112 start-stop-daemon
--start --exec "$NFS_STATD"
116 # WARNING: this kills any process with the executable
118 echo -n 'stopping statd: '
119 start-stop-daemon
--stop --quiet --signal 1 --name statd
122 #----------------------------------------------------------------------
127 # reload: reloads the exports file
128 # restart: stops and starts mountd
129 #FIXME: need to create the /var/lib/nfs/... directories
131 start
) create_directories
132 start_nfsd
"$NFS_SERVERS"
135 test -r /etc
/exports
&& exportfs
-a;;
140 reload
) test -r /etc
/exports
&& exportfs
-r;;
144 # restart does not restart the kernel threads,
145 # only the user mode processes
148 test -r /etc
/exports
&& exportfs
-a;;