<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: need script to umount filesystems from an array in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008265#M98984</link>
    <description>Assuming that the config file is just a list of mountpoints (or source devicefiles):&lt;BR /&gt; &lt;BR /&gt;FS_CONF="/opt/sysadmin/etc/umountlist.conf"&lt;BR /&gt;&lt;BR /&gt;# build array from conf file&lt;BR /&gt;cat $FS_CONF | while read MNT EXTRA&lt;BR /&gt;do&lt;BR /&gt;umount $MNT&lt;BR /&gt;if [ $? -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt; echo "\numount failed for $MNT"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt; &lt;BR /&gt;The error message is printed when umount fails. The EXTRA variable is to take care of anything trailing the first item in the line. Otherwise, everything on the line goes into $MNT</description>
    <pubDate>Thu, 12 Oct 2006 09:49:42 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2006-10-12T09:49:42Z</dc:date>
    <item>
      <title>need script to umount filesystems from an array</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008264#M98983</link>
      <description>Environment and situation: Disaster Recovery server is a clone of Production server.  Certain logical volumes can not be mounted on the DR server while production server is up (or it will interfere with the databases). In a DR situation, the volumes will be mounted. I am creating a script to unmount the file systems at the end of a DR situation (when the original production box would be brought back online).  &lt;BR /&gt;The script: I have created a text file with the file systems which will need unmounted.  I've started a script which will put the text file in an array.&lt;BR /&gt;FS_CONF="/opt/sysadmin/etc/umountlist.conf"&lt;BR /&gt;&lt;BR /&gt;# build array from conf file&lt;BR /&gt;FS[@]=`cat $FS_CONF`&lt;BR /&gt;&lt;BR /&gt;I'm having trouble figuring out how to process each array variable in a umount command and moving to the next one and ending at the eof.  Any ideas on how to write this part of the script?&lt;BR /&gt;&lt;BR /&gt;~T</description>
      <pubDate>Thu, 12 Oct 2006 09:44:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008264#M98983</guid>
      <dc:creator>TZ_1</dc:creator>
      <dc:date>2006-10-12T09:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: need script to umount filesystems from an array</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008265#M98984</link>
      <description>Assuming that the config file is just a list of mountpoints (or source devicefiles):&lt;BR /&gt; &lt;BR /&gt;FS_CONF="/opt/sysadmin/etc/umountlist.conf"&lt;BR /&gt;&lt;BR /&gt;# build array from conf file&lt;BR /&gt;cat $FS_CONF | while read MNT EXTRA&lt;BR /&gt;do&lt;BR /&gt;umount $MNT&lt;BR /&gt;if [ $? -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt; echo "\numount failed for $MNT"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt; &lt;BR /&gt;The error message is printed when umount fails. The EXTRA variable is to take care of anything trailing the first item in the line. Otherwise, everything on the line goes into $MNT</description>
      <pubDate>Thu, 12 Oct 2006 09:49:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008265#M98984</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2006-10-12T09:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: need script to umount filesystems from an array</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008266#M98985</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If your file simply contains the mountpoint names, why not simply read it and perform your unmount?  For example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read X MNTPT X&lt;BR /&gt;do&lt;BR /&gt;    echo ${MNTPT}&lt;BR /&gt;done &amp;lt; /etc/fstab&lt;BR /&gt;&lt;BR /&gt;...change the 'echo' appropriately.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 12 Oct 2006 09:51:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008266#M98985</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-10-12T09:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: need script to umount filesystems from an array</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008267#M98986</link>
      <description>no array needed.  thanks for the quick and accurate responses.&lt;BR /&gt;~TZ</description>
      <pubDate>Thu, 12 Oct 2006 10:04:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-script-to-umount-filesystems-from-an-array/m-p/5008267#M98986</guid>
      <dc:creator>TZ_1</dc:creator>
      <dc:date>2006-10-12T10:04:24Z</dc:date>
    </item>
  </channel>
</rss>

