]> git.pld-linux.org Git - packages/nfs-utils.git/blame - nfsfs.init
- fixed previous change
[packages/nfs-utils.git] / nfsfs.init
CommitLineData
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.
16if [ ! -f /etc/sysconfig/network ]; then
ff100ffc 17 exit 0
9fddaaa8
JR
18fi
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 27if 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
32else
33 exit 0
9fddaaa8
JR
34fi
35
ff100ffc 36
9fddaaa8
JR
37# See how we were called.
38case "$1" in
39 start)
40 show "Mounting NFS filesystems"
41 busy
42 mount -a -t nfs
9fddaaa8
JR
43 ok
44 touch /var/lock/subsys/nfsfs
45 ;;
46 stop)
5da51246 47 if [ -f /proc/mounts ]; then
eafe4dfc 48 fsfile="/proc/mounts"
49 else
50 fsfile="/etc/mtab"
51 fi
52
9fddaaa8
JR
53 show "Unmounting NFS filesystems"
54 busy
c4b46c9c 55 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
5246d326 56 while [ -n "$remaining" -a 3 -gt 0 ]; do
c4b46c9c
PG
57 fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile`
58 sleep 2
59 fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile`
e0421f53 60 umount -a -f -t nfs
764423e2 61 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
c4b46c9c 62 done
9fddaaa8
JR
63 ok
64 rm -f /var/lock/subsys/nfsfs
65 ;;
66 status)
5da51246 67 if [ -f /proc/mounts ]; then
9fddaaa8 68 echo "Configured NFS mountpoints:"
0c170055
JB
69 grep -v '^#' /etc/fstab | \
70 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
9fddaaa8 71 echo "Active NFS mountpoints:"
0c170055
JB
72 grep -v '^#' /proc/mounts | \
73 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
9fddaaa8
JR
74 else
75 echo "/proc filesystem unavailable"
76 fi
77 ;;
78 restart)
79 $0 stop
80 $0 start
81 ;;
5246d326 82 reload|force-reload)
9fddaaa8
JR
83 mount -a -t nfs
84 ;;
85 *)
5246d326 86 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
87 exit 3
9fddaaa8
JR
88esac
89
90exit 0
This page took 0.107332 seconds and 4 git commands to generate.