summaryrefslogtreecommitdiff
blob: fa54bdb207a5be372057a59d22780bb80fb2ce9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

#---------------------------------------------------------------------------
# This script starts/stops nfsd and mountd
# Daemons rpc.rquotad, rpc.rstatd, rpc.rusersd, rpc.rwalld and rpc.sprayd
# should be started from inetd on FreeBSD.
#---------------------------------------------------------------------------

extra_started_commands="reload"

# The binary locations
nfsd=/usr/sbin/nfsd
mountd=/usr/sbin/mountd

depend() {
	use ypbind net rpc.lockd
	need rpcbind
	after quota
}

start() {
	ebegin "Starting NFS daemon"
	start-stop-daemon --start --quiet --exec \
		$nfsd -- ${nfsdopts}
	eend $? "Error starting NFS daemon"

	# Start mountd
	ebegin "Starting NFS mountd"
	start-stop-daemon --start --quiet --exec \
		$mountd -- ${mountdopts} ${exportsfile}
	eend $? "Error starting NFS mountd"
}

stop() {
	ebegin "Stopping NFS mountd"
	start-stop-daemon --stop --quiet --exec $mountd \
		--pidfile /var/run/mountd.pid
	eend $? "Error stopping NFS mountd"

	ebegin "Stopping NFS daemon"
	start-stop-daemon --stop --signal USR1 --quiet \
		--name nfsd --user root
	eend $? "Error stopping NFS daemon"
}

reload() {
	# Hangup signal to mountd reloads /etc/exports.
	ebegin "Reloading /etc/exports"
	start-stop-daemon --signal 1 --quiet --exec $mountd \
		--pidfile /var/run/mountd.pid
	eend $?
}