summaryrefslogtreecommitdiff
path: root/sys-freebsd/freebsd-usbin/files/nfsmount.initd
blob: dfa9a101dc8dfb053799fc76f5f850c7ec7bdcda (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
55
56
57
58
59
60
61
62
63
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

depend() {
	need net rpcbind
	use ypbind
}

start_statd() {
	# Don't start rpc.statd if already started by init.d/nfs
	killall -0 rpc.statd 2>/dev/null && return 0
	ebegin "Starting NFS statd"
	rpc.statd
	eend $? "Error starting NFS statd"
}

stop_statd() {
	# Don't stop rpc.statd if it's in use by init.d/nfs
	killall -0 nfsd 2>/dev/null && return 0
	# Make sure it's actually running
	killall -0 rpc.statd 2>/dev/null || return 0
	# Okay, all tests passed, stop rpc.statd
	ebegin "Stopping NFS statd"
	killall rpc.statd
	eend $? "Error stopping NFS statd"
}

start_lockd() {
	# Don't start rpc.lockd if already started by init.d/nfs
	killall -0 rpc.lockd 2>/dev/null && return 0
	ebegin "Starting NFS lockd"
	rpc.lockd
	eend $? "Error starting NFS lockd"
}

stop_lockd() {
	# Don't stop rpc.lockd if it's in use by init.d/nfs
	killall -0 nfsd 2>/dev/null && return 0
	# Make sure it's actually running
	killall -0 rpc.lockd 2>/dev/null || return 0
	# Okay, all tests passed, stop rpc.lockd
	ebegin "Stopping NFS lockd"
	killall rpc.lockd
	eend $? "Error stopping NFS lockd"
}

start() {
	start_statd
	start_lockd
	ebegin "Mounting NFS filesystems"
	mount -a -t nfs
	eend $? "Error mounting NFS filesystems"
}

stop() {
	ebegin "Unmounting NFS filesystems"
	umount -a -t nfs
	eend $? "Error unmounting NFS filesystems"
	stop_statd
	stop_lockd
}