summaryrefslogtreecommitdiff
blob: c2bc51c1ce2147c718d9fe834ce8e4d69eb87d60 (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
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfsmount-0.3.1-r6,v 1.2 2001/12/06 20:17:02 azarah Exp $

opts="start stop restart"

depend() {
    need net portmap
}

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

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

start() {
    start_statd
    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
}

restart() {
    stop
    start
}