home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20101108.etc.tar.gz / bradford.20101108.etc.tar / etc / init.d / nfs < prev    next >
Text File  |  2006-02-21  |  3KB  |  136 lines

  1. #! /bin/bash
  2. # Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
  3. # All rights reserved.
  4. #
  5. # Author: Florian La Roche, 1996
  6. #      Werner Fink <werner@suse.de>, 1996
  7. #      Burchard Steinbild, 1996
  8. #
  9. # Please send feedback to http://www.suse.de/feedback
  10. #
  11. # /etc/init.d/nfs
  12. #
  13. ### BEGIN INIT INFO
  14. # Provides:       nfs
  15. # Required-Start: $network $portmap
  16. # Required-Stop:
  17. # Default-Start:  3 5
  18. # Default-Stop:
  19. # Description:    Imports remote Network File Systems (NFS)
  20. ### END INIT INFO
  21.  
  22. . /etc/rc.status
  23.  
  24. nfs=no
  25. LDCONFIG_NEEDED=0
  26. while read  where what type options rest  ; do
  27.     case "$where" in
  28.     \#*|"") ;;
  29.     *) case "$options" in
  30.         *noauto*) ;;
  31.         *) if test "$type" = "nfs" -o "$type" = "nfs4" ; then
  32.             nfs=yes
  33.             case "$where" in
  34.             /usr*|/opt*)
  35.                 LDCONFIG_NEEDED=1
  36.                 break
  37.                 ;;
  38.             *)
  39.                 if grep -q "^$where" /etc/ld.so.conf; then
  40.                     LDCONFIG_NEEDED=1
  41.                     break;
  42.                 fi
  43.                 ;;
  44.             esac
  45.         fi ;;
  46.         esac
  47.     esac
  48. done < /etc/fstab
  49.  
  50. rc_reset
  51. case "$1" in
  52.     start|reload)
  53.     echo -n "Importing Net File System (NFS)"
  54.     if test "$nfs" = yes ; then
  55.     # Mount all auto NFS devices (-> nfs(5) and mount(8) )
  56.     #  NFS-Server sometime not reachable during boot phase.
  57.     #  It's sometime usefull to mount NFS devices in
  58.     #  background with an ampersand (&) and a sleep time of
  59.     #  two or more seconds, e.g:
  60.     #  
  61.     #   sleep 2 && mount -at nfs,nfs4 &
  62.     #   sleep 2 
  63.     #  
  64.     #  Note: Some people importing the /usr partition.
  65.     #        Therefore we do _NOT_ use an ampersand!
  66.     #
  67.       mount -at nfs,nfs4
  68.     #
  69.         # generate new list of available shared libraries
  70.     #
  71.       if test "$LDCONFIG_NEEDED" -gt 0; then
  72.           rc_status
  73.           sleep 1
  74.           # check if ld.so.cache needs to be refreshed
  75.           /etc/init.d/boot.ldconfig start > /dev/null 2>&1
  76.       fi
  77.  
  78.       rc_status -v
  79.     else
  80.       rc_status -u
  81.     fi
  82.     ;;
  83.     stop)
  84.     echo -n "Remove Net File System (NFS)"
  85.     if test "$nfs" = "yes" ; then
  86.       #
  87.       # Unmount in background because during long timeouts
  88.       #
  89.       umount -at nfs,nfs4 &
  90.       sleep 2
  91.       rc_status -v
  92.     else
  93.       rc_status -u
  94.     fi
  95.     ;;
  96.     restart|force-reload)
  97.         ## Stop the service and regardless of whether it was
  98.     ## running or not, start it again.
  99.     $0 stop
  100.     $0 start
  101.     rc_status
  102.     ;;
  103.     status)
  104.     echo -n "Checking for mounted nfs shares (from /etc/fstab):"
  105.     if test "$nfs" = "yes" ; then
  106.       while read  where what type options rest  ; do
  107.         case "$where" in
  108.           \#*|"") ;;
  109.           *) case "$options" in
  110.            *noauto*) ;;
  111.            *) if test "$type" = "nfs" -o "$type" = "nfs4" ; then
  112.             grep -q "$where $what nfs" /proc/mounts || rc_failed 3
  113.               fi ;;
  114.          esac
  115.         esac
  116.           done < /etc/fstab
  117.         else
  118.       rc_failed 3
  119.     fi
  120.         rc_status -v
  121.     ;;
  122.     try-restart|condrestart)
  123.     $0 status
  124.     if test $? = 0; then
  125.         $0 restart
  126.     else
  127.         rc_reset
  128.     fi
  129.     rc_status
  130.     ;;
  131.     *)
  132.     echo "Usage: $0 {start|stop|status|reload|force-reload|restart|try-restart}"
  133.     exit 1
  134. esac
  135. rc_exit
  136.