[HPADM] SUMMARY - Modification of fstab via a script

From: McIntosh Alan-R54071 (alan_at_motorola.com)
Date: 01/13/04

  • Next message: Abramson, Stuart: "[HPADM] Slow archive log sync times on Oracle SID BCV"
    To: McIntosh Alan-R54071 <alan@motorola.com>, "Hpux (hpux-admin@dutchworks.nl)" <hpux-admin@DutchWorks.nl>
    Date: Tue, 13 Jan 2004 11:57:09 -0700
    
    

    That was quick!! I received a good suggestion to use sed, which probably would
    have been a lot easier since it was a global replacement. A couple people told
    me they were on vacation(I think) in several languages!! ;-)
     
    The answer, which was probably the one technique I did not try, was given by
    Bill T. and Chris S. - to comment out the end of file dollar sign in my global
    replacement:
     
    1,\$s/${VG}/${NEWVG}/g
     
    Thanks for the quick help!!
     
    - Alan

    -----Original Message-----
    From: hpux-admin-owner@DutchWorks.nl [mailto:hpux-admin-owner@DutchWorks.nl] On Behalf Of McIntosh Alan-R54071
    Sent: Tuesday, January 13, 2004 11:08 AM
    To: Hpux (hpux-admin@dutchworks.nl)
    Subject: [HPADM] Modification of fstab via a script

     

    Script Guru's,
     
    I am at a loss trying to figure out why the modification of the fstab fails from
    within a script(modification section listed below), yet works fine from the
    command line.
     
    --------------------------------------------snip-----------------------------------------------
    #!/bin/sh
    #
    # The bulk of the script has already been completed and this is the last section to
    # be completed. The '$VG' and '$NEWVG' variables have been set previously and
    # the mount command works fine.
    #
    if [[ `mount /dev/$NEWVG/lvol3 /mnt` -eq 0 ]] ; then
    # change "vg00 ($VG)" to "vg01($NEWVG)"
    ed - /mnt/etc/fstab << END
    1
    1,$s/${VG}/${NEWVG}/g
    .
    w
    q
    END
          umount /mnt
    else
            error "Unable to mount /mnt on /dev/$NEWVG/lvol3, please modify /etc/fstab manually!!"
    fi
    --------------------------------------------snap----------------------------------------------
     
    There is no error indicated, but the changes are not made and saved as they
    are from the command line. I have never had a problem using 'ed' to modify
    scripts before. What the heck is going on with this script?! Thanks in advance
    for any suggestions.
     
    -Alan McIntosh
     

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: Abramson, Stuart: "[HPADM] Slow archive log sync times on Oracle SID BCV"

    Relevant Pages