]>
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) | |
8a5cc778 | 40 | run_cmd "Mounting NFS filesystems" mount -a -t nfs |
9fddaaa8 JR |
41 | touch /var/lock/subsys/nfsfs |
42 | ;; | |
43 | stop) | |
5da51246 | 44 | if [ -f /proc/mounts ]; then |
eafe4dfc | 45 | fsfile="/proc/mounts" |
46 | else | |
47 | fsfile="/etc/mtab" | |
48 | fi | |
49 | ||
9fddaaa8 JR |
50 | show "Unmounting NFS filesystems" |
51 | busy | |
af9ed1fb | 52 | retry=3 |
c4b46c9c | 53 | remaining=$(awk '$3 == "nfs" {print $2}' $fsfile) |
af9ed1fb | 54 | while [ -n "$remaining" -a $retry -gt 0 ]; do |
c4b46c9c PG |
55 | fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile` |
56 | sleep 2 | |
57 | fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile` | |
e0421f53 | 58 | umount -a -f -t nfs |
764423e2 | 59 | remaining=$(awk '$3 == "nfs" {print $2}' $fsfile) |
af9ed1fb | 60 | retry=$(($retry-1)) |
c4b46c9c | 61 | done |
9fddaaa8 JR |
62 | ok |
63 | rm -f /var/lock/subsys/nfsfs | |
64 | ;; | |
65 | status) | |
5da51246 | 66 | if [ -f /proc/mounts ]; then |
9fddaaa8 | 67 | echo "Configured NFS mountpoints:" |
0c170055 JB |
68 | grep -v '^#' /etc/fstab | \ |
69 | awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}' | |
9fddaaa8 | 70 | echo "Active NFS mountpoints:" |
0c170055 JB |
71 | grep -v '^#' /proc/mounts | \ |
72 | awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}' | |
9fddaaa8 JR |
73 | else |
74 | echo "/proc filesystem unavailable" | |
75 | fi | |
76 | ;; | |
77 | restart) | |
78 | $0 stop | |
79 | $0 start | |
80 | ;; | |
5246d326 | 81 | reload|force-reload) |
9fddaaa8 JR |
82 | mount -a -t nfs |
83 | ;; | |
84 | *) | |
5246d326 | 85 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" |
86 | exit 3 | |
9fddaaa8 JR |
87 | esac |
88 | ||
89 | exit 0 |