]> git.pld-linux.org Git - packages/nfs-utils.git/blob - nfsfs.init
perl -pi -e "s/pld-list\@pld.org.pl/feedback\@pld.org.pl/"
[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 . /etc/sysconfig/network
24
25 # Check that networking is up.
26 if is_no "${NETWORKING}"; then
27         msg_Network_Down nfsfs
28         exit 1
29 fi
30
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
36 # See how we were called.
37 case "$1" in
38   start)
39         if [ -z "$CONFIGUREDNFSMOUNTPOINTS" ] ; then
40                 echo "There are no configured NFS mountpoints!"
41         else
42         show "Mounting NFS filesystems"
43         busy
44         mount -a -t nfs
45         deltext
46         ok
47         touch /var/lock/subsys/nfsfs
48         fi
49         ;;
50   stop)
51         if [ -f /proc/mounts ] ; then
52                 fsfile="/proc/mounts"
53         else
54                 fsfile="/etc/mtab"
55         fi
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
62
63         show "Unmounting NFS filesystems"
64         busy
65         fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile`
66         sleep 2
67         fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile`
68         umount -a -t nfs
69         deltext
70         ok
71         rm -f /var/lock/subsys/nfsfs
72         fi
73         ;;
74   status)
75         if [ -f /proc/mounts ] ; then
76                 echo "Configured NFS mountpoints:"
77                 echo "$CONFIGUREDNFSMOUNTPOINTS"
78                 echo "Active NFS mountpoints:"
79                 echo "$ACTIVENFSMOUNTPOINTS"
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   *)
92         msg_Usage "$0 {start|stop|restart|reload|status}"
93         exit 1
94 esac
95
96 exit 0
97
This page took 0.037711 seconds and 3 git commands to generate.