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