]>
Commit | Line | Data |
---|---|---|
9fddaaa8 JR |
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 | # | |
9034116f | 9 | # chkconfig: 345 15 88 |
9fddaaa8 JR |
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 | . /etc/sysconfig/network | |
24 | ||
25 | # Check that networking is up. | |
bf36188d JR |
26 | if is_no "${NETWORKING}"; then |
27 | msg_Network_Down nfsfs | |
28 | exit 1 | |
9fddaaa8 JR |
29 | fi |
30 | ||
cee3489f | 31 | CONFIGUREDNFSMOUNTPOINTS="`grep -v '^#' /etc/fstab | \ |
32 | awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'`" | |
33 | ACTIVENFSMOUNTPOINTS="`grep -v '^#' /proc/mounts | \ | |
34 | awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'`" | |
35 | ||
9fddaaa8 JR |
36 | # See how we were called. |
37 | case "$1" in | |
38 | start) | |
cee3489f | 39 | if [ -z "$CONFIGUREDNFSMOUNTPOINTS" ] ; then |
40 | echo "There are no configured NFS mountpoints!" | |
41 | else | |
9fddaaa8 JR |
42 | show "Mounting NFS filesystems" |
43 | busy | |
44 | mount -a -t nfs | |
45 | deltext | |
46 | ok | |
47 | touch /var/lock/subsys/nfsfs | |
cee3489f | 48 | fi |
9fddaaa8 JR |
49 | ;; |
50 | stop) | |
eafe4dfc | 51 | if [ -f /proc/mounts ] ; then |
52 | fsfile="/proc/mounts" | |
53 | else | |
54 | fsfile="/etc/mtab" | |
55 | fi | |
cee3489f | 56 | |
57 | if [ -z "$CONFIGUREDNFSMOUNTPOINTS" ] ; then | |
58 | echo "There are no configured NFS mountpoints!" | |
59 | elif [ -z "$ACTIVENFSMOUNTPOINTS" ] ; then | |
60 | echo "There are no active NFS mountpoints!" | |
61 | else | |
eafe4dfc | 62 | |
9fddaaa8 JR |
63 | show "Unmounting NFS filesystems" |
64 | busy | |
eafe4dfc | 65 | fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile` |
1215427c | 66 | sleep 2 |
eafe4dfc | 67 | fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile` |
9fddaaa8 JR |
68 | umount -a -t nfs |
69 | deltext | |
70 | ok | |
71 | rm -f /var/lock/subsys/nfsfs | |
cee3489f | 72 | fi |
9fddaaa8 JR |
73 | ;; |
74 | status) | |
75 | if [ -f /proc/mounts ] ; then | |
76 | echo "Configured NFS mountpoints:" | |
cee3489f | 77 | echo "$CONFIGUREDNFSMOUNTPOINTS" |
9fddaaa8 | 78 | echo "Active NFS mountpoints:" |
cee3489f | 79 | echo "$ACTIVENFSMOUNTPOINTS" |
9fddaaa8 JR |
80 | else |
81 | echo "/proc filesystem unavailable" | |
82 | fi | |
83 | ;; | |
84 | restart) | |
85 | $0 stop | |
86 | $0 start | |
87 | ;; | |
88 | reload) | |
89 | mount -a -t nfs | |
90 | ;; | |
91 | *) | |
bf36188d | 92 | msg_Usage "$0 {start|stop|restart|reload|status}" |
9fddaaa8 JR |
93 | exit 1 |
94 | esac | |
95 | ||
96 | exit 0 | |
97 |