]> git.pld-linux.org Git - packages/nfs-utils.git/blob - nfsfs.init
- cleaning
[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 ]; 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         show "Mounting NFS filesystems"
41         busy
42         mount -a -t nfs
43         ok
44         touch /var/lock/subsys/nfsfs
45         ;;
46   stop)
47         if [ -f /proc/mounts ] ; then
48                 fsfile="/proc/mounts"
49         else
50                 fsfile="/etc/mtab"
51         fi
52
53         show "Unmounting NFS filesystems"
54         busy
55         remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
56         while [ -n "$remaining" -a 3 -gt 0 ]
57         do
58                 fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile`
59                 sleep 2
60                 fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile`
61                 umount -a -f -t nfs
62                 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
63         done
64         ok
65         rm -f /var/lock/subsys/nfsfs
66         ;;
67   status)
68         if [ -f /proc/mounts ] ; then
69                 echo "Configured NFS mountpoints:"
70                 grep -v '^#' /etc/fstab | \
71                   awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
72                 echo "Active NFS mountpoints:"
73                 grep -v '^#' /proc/mounts | \
74                   awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
75         else
76                 echo "/proc filesystem unavailable"
77         fi
78         ;;
79   restart)
80         $0 stop
81         $0 start
82         ;;
83   reload)
84         mount -a -t nfs
85         ;;
86   *)
87         msg_usage "$0 {start|stop|restart|reload|status}"
88         exit 1
89 esac
90
91 exit 0
This page took 0.03704 seconds and 4 git commands to generate.