home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
rescue
/
etc
/
init.d
/
nfs
< prev
next >
Wrap
Text File
|
2006-11-29
|
3KB
|
136 lines
#! /bin/bash
# Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Florian La Roche, 1996
# Werner Fink <werner@suse.de>, 1996
# Burchard Steinbild, 1996
#
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/nfs
#
### BEGIN INIT INFO
# Provides: nfs
# Required-Start: $network $portmap
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Imports remote Network File Systems (NFS)
### END INIT INFO
. /etc/rc.status
nfs=no
LDCONFIG_NEEDED=0
while read where what type options rest ; do
case "$where" in
\#*|"") ;;
*) case "$options" in
*noauto*) ;;
*) if test "$type" = "nfs" -o "$type" = "nfs4" ; then
nfs=yes
case "$where" in
/usr*|/opt*)
LDCONFIG_NEEDED=1
break
;;
*)
if grep -q "^$where" /etc/ld.so.conf; then
LDCONFIG_NEEDED=1
break;
fi
;;
esac
fi ;;
esac
esac
done < /etc/fstab
rc_reset
case "$1" in
start|reload)
echo -n "Importing Net File System (NFS)"
if test "$nfs" = yes ; then
# Mount all auto NFS devices (-> nfs(5) and mount(8) )
# NFS-Server sometime not reachable during boot phase.
# It's sometime usefull to mount NFS devices in
# background with an ampersand (&) and a sleep time of
# two or more seconds, e.g:
#
# sleep 2 && mount -at nfs,nfs4 &
# sleep 2
#
# Note: Some people importing the /usr partition.
# Therefore we do _NOT_ use an ampersand!
#
mount -at nfs,nfs4
#
# generate new list of available shared libraries
#
if test "$LDCONFIG_NEEDED" -gt 0; then
rc_status
sleep 1
# check if ld.so.cache needs to be refreshed
/etc/init.d/boot.ldconfig start > /dev/null 2>&1
fi
rc_status -v
else
rc_status -u
fi
;;
stop)
echo -n "Remove Net File System (NFS)"
if test "$nfs" = "yes" ; then
#
# Unmount in background because during long timeouts
#
umount -at nfs,nfs4 &
sleep 2
rc_status -v
else
rc_status -u
fi
;;
restart|force-reload)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for mounted nfs shares (from /etc/fstab):"
if test "$nfs" = "yes" ; then
while read where what type options rest ; do
case "$where" in
\#*|"") ;;
*) case "$options" in
*noauto*) ;;
*) if test "$type" = "nfs" -o "$type" = "nfs4" ; then
grep -q "$where $what nfs" /proc/mounts || rc_failed 3
fi ;;
esac
esac
done < /etc/fstab
else
rc_failed 3
fi
rc_status -v
;;
try-restart|condrestart)
$0 status
if test $? = 0; then
$0 restart
else
rc_reset
fi
rc_status
;;
*)
echo "Usage: $0 {start|stop|status|reload|force-reload|restart|try-restart}"
exit 1
esac
rc_exit