]> git.pld-linux.org Git - packages/nfs-utils.git/blob - nfsfs.init
- idmapd fixes
[packages/nfs-utils.git] / nfsfs.init
1 #!/bin/sh
2 #
3 # nfsfs         Mount NFS filesystems.
4 #
5 # Version:      @(#) /etc/init.d/skeleton 1.01 26-Oct-1993
6 #
7 # Author:       Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
8 #
9 # chkconfig:    345 15 88
10 # description:  Mounts and unmounts all Network File System (NFS) \
11 #               mount points.
12 #
13 # $Id$
14
15 # Source networking configuration.
16 if [ ! -f /etc/sysconfig/network ]; then
17         exit 0
18 fi
19
20 # Source function library.
21 . /etc/rc.d/init.d/functions
22
23 # Get network config
24 . /etc/sysconfig/network
25
26 # Check that networking is up.
27 if is_yes "${NETWORKING}"; then
28         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
29                 msg_network_down nfsfs
30                 exit 1
31         fi
32 else
33         exit 0
34 fi
35
36
37 # See how we were called.
38 case "$1" in
39   start)
40         if [ ! -f /var/lock/subsys/nfsfs ]; then
41             if [ "$NFSDTYPE" != "U" ] && grep -q nfs4 /proc/filesystems; then
42                 if [ ! -f /var/lock/subsys/idmapd ]; then
43                     msg_starting "NFS idmapd"
44                     daemon rpc.idmapd $RPCIDMAPOPTIONS
45                 fi
46                 msg_starting "NFS gssd"
47                 daemon rpc.gssd $RPCGSSOPTIONS
48             fi
49             run_cmd "Mounting NFS filesystems" mount -a -t nfs
50             touch /var/lock/subsys/nfsfs
51         else
52             msg_already_running "NFSFS"
53         fi
54         ;;
55   stop)
56         if [ -f /proc/mounts ]; then
57                 fsfile="/proc/mounts"
58         else
59                 fsfile="/etc/mtab"
60         fi
61
62         show "Unmounting NFS filesystems"
63         busy
64         retry=3
65         remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
66         while [ -n "$remaining" -a $retry -gt 0 ]; do
67                 fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile`
68                 sleep 2
69                 fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile`
70                 umount -a -f -t nfs
71                 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
72                 retry=$(($retry-1))
73         done
74         ok
75         if [ "$NFSDTYPE" != "U" ] && grep -q nfs4 /proc/filesystems; then
76             msg_stopping "NFS gssd"
77             killproc rpc.gssd
78             if [ -f /var/lock/subsys/idmapd -a ! -f /var/lock/subsys/nfs ]; then
79                 msg_stopping "NFS idmapd"
80                 killproc rpc.idmapd
81                 rm -f /var/lock/subsys/idmapd
82             fi
83         fi
84         rm -f /var/lock/subsys/nfsfs
85         ;;
86   status)
87         if [ -f /proc/mounts ]; then
88                 echo "Configured NFS mountpoints:"
89                 grep -v '^#' /etc/fstab | \
90                   awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
91                 echo "Active NFS mountpoints:"
92                 grep -v '^#' /proc/mounts | \
93                   awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
94         else
95                 echo "/proc filesystem unavailable"
96         fi
97         ;;
98   restart)
99         $0 stop
100         $0 start
101         ;;
102   reload|force-reload)
103         mount -a -t nfs
104         ;;
105   *)
106         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
107         exit 3
108 esac
109
110 exit 0
This page took 0.128924 seconds and 4 git commands to generate.