home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mountfs.zip / mountfs.cmd next >
OS/2 REXX Batch file  |  1995-07-07  |  1KB  |  49 lines

  1. /* ========================================== */
  2. /* REXX    MOUNTFS.CMD        MHP   5/95      */
  3. /* Unmount and remount all NFS drives that    */
  4. /* are listed in the FSTAB file.              */
  5. /* Uses the ETC environment variable to find  */
  6. /* the FSTAB file.                            */
  7. /* ------------------------------------------ */
  8. /* Mike Prager   mikep@aurora.tib.nmfs.gov    */
  9. /* ========================================== */
  10. call RxFuncAdd SysLoadFuncs,RexxUtil,SysLoadFuncs
  11. call SysLoadFuncs
  12.  
  13. /*---Get the name of FSTAB in a standard format---*/
  14. env='OS2ENVIRONMENT'
  15. temp= value('etc',,env)
  16. len = length(temp)
  17. if substr(temp,len) ¬= "\" then temp = temp || "\"
  18. filename = temp || "fstab"
  19. say "*** MOUNTFS    MHP   May 1995"
  20. say "*** Examining" filename "..."
  21.  
  22. index = 1
  23.  
  24. /*---Load the FSTAB entries into an array (entry)---*/
  25. do forever
  26.    if lines(filename) = 0 then leave
  27.    line = linein(filename)
  28.    hash = substr(line,1,1)
  29.    if hash ¬= "#" then do
  30.       entry.index = line
  31.       index = index + 1
  32.    end /* do */
  33. end
  34.  
  35. entry.0 = index - 1
  36.  
  37. say "*** There are" entry.0 "drives to be mounted."
  38.  
  39. /*---Unmount everything now mounted---*/
  40. "@umount *"
  41.  
  42. /*---Mount the drives---*/
  43. do index = 1 to entry.0
  44.    entry.index
  45. end
  46.  
  47. say "*** MOUNTFS done."
  48. /*==================End of Program===================*/
  49.