<?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: Help with Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590685#M725633</link>
    <description>If this is a one-time task then the above suggestions should work if you have enough space to hold the tar archive.&lt;BR /&gt;&lt;BR /&gt;However, if this is a regular task and (some of) these files are large then you could use a batch ftp to accomplish this task (assumptions: both systems have the named directories in $DIRS):&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;# replicate RCMO files in system B&lt;BR /&gt;&lt;BR /&gt;REMOTECPU="myname.domain.com"&lt;BR /&gt;USER=somelogin&lt;BR /&gt;PW=somePW &lt;BR /&gt;DIRS="/hpm30 /hpm31 /hpm32"&lt;BR /&gt;&lt;BR /&gt;for MYDIR in 30 31 32&lt;BR /&gt;do&lt;BR /&gt;/usr/bin/ftp -n -v &amp;lt;&amp;lt; EOF&lt;BR /&gt;open $REMOTECPU&lt;BR /&gt;user $USER $PW&lt;BR /&gt;lcd $DIRS&lt;BR /&gt;cd $DIRS&lt;BR /&gt;prompt&lt;BR /&gt;binary&lt;BR /&gt;mput RCMO\*&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;&lt;BR /&gt;The RCMO\* needs the \* to prevent the shell's file matching from substituting anything in the local directory where the script is run. We want ftp to see the *, not the shell, since ftp must perform the match.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Sat, 06 Oct 2001 18:39:24 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2001-10-06T18:39:24Z</dc:date>
    <item>
      <title>Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590678#M725626</link>
      <description>Hello, &lt;BR /&gt;&lt;BR /&gt;I am trying to write a script with the following requirements. &lt;BR /&gt;&lt;BR /&gt;System A&lt;BR /&gt;---------&lt;BR /&gt;&lt;BR /&gt;/hpm30/RCMO.dbf&lt;BR /&gt;/hpm31/RCMOtest.dbf&lt;BR /&gt;/hpm31/RCMOdata.dbf&lt;BR /&gt;/hpm32/RCMOlog.data&lt;BR /&gt;&lt;BR /&gt;These directories also have other files that do not begin with RCMO.&lt;BR /&gt;&lt;BR /&gt;I want to 'find' all files that begin with RCMO&lt;BR /&gt;in all the directories and 'tar' all the files &lt;BR /&gt;into a tar file which can be 'ftped' to the System B and untarred to the respective directories. These two systems are in two different locations and 'rdist' may not be an option. I get faster transfer rates with FTP.&lt;BR /&gt;&lt;BR /&gt;System B&lt;BR /&gt;--------&lt;BR /&gt;&lt;BR /&gt;/hpm30&lt;BR /&gt;/hpm31&lt;BR /&gt;/hpm31&lt;BR /&gt;/hpm32&lt;BR /&gt;&lt;BR /&gt;Thank you - Subbu</description>
      <pubDate>Sat, 06 Oct 2001 12:58:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590678#M725626</guid>
      <dc:creator>Subbu Krishna</dc:creator>
      <dc:date>2001-10-06T12:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590679#M725627</link>
      <description>Hi Subbu,&lt;BR /&gt;&lt;BR /&gt;One way of doing it is&lt;BR /&gt;&lt;BR /&gt;find hpm* -name RCMO\* -exec tar rvf mydbf.tar {} \;&lt;BR /&gt;&lt;BR /&gt;tar tvf mydbf.tar&lt;BR /&gt;&lt;BR /&gt;In the find command you are looking for files starting with RCMO in directories starting with hpm.&lt;BR /&gt;Once the tar file is created, just check the contents using tar tvf.&lt;BR /&gt;&lt;BR /&gt;Look at the man page for find, if you want more options.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh</description>
      <pubDate>Sat, 06 Oct 2001 14:00:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590679#M725627</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-10-06T14:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590680#M725628</link>
      <description>Hi Subbu,&lt;BR /&gt;&lt;BR /&gt;Looks like you asked the same question twice.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,11866,0x15f6c6af36b7d5118ff10090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,11866,0x15f6c6af36b7d5118ff10090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Ramesh</description>
      <pubDate>Sat, 06 Oct 2001 14:05:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590680#M725628</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-10-06T14:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590681#M725629</link>
      <description>I answered the duplicat thread so here it is again&lt;BR /&gt;&lt;BR /&gt;This does not answer you question directly, but it is what I would do..... &lt;BR /&gt;&lt;BR /&gt;If you set up equivalences between the two systems you could do the xfr in one go &amp;amp; half the time!!!! &lt;BR /&gt;&lt;BR /&gt;test equivalence on systemA, best as root, but oracle should also be OK &lt;BR /&gt;# remsh systemB ls &lt;BR /&gt;&lt;BR /&gt;If this works &lt;BR /&gt;# tar cf - $(find &lt;FILESYS&gt; -name RCMO\*) | remsh systemB "cd &lt;FILESYS&gt;; tar xf -" &lt;BR /&gt;&lt;BR /&gt;It is important that &lt;FILESYS&gt; is the same on both systems else it will untar it in the wrong directory (unless that is what you want). You could make &lt;FILESYS&gt; / if you wish but the find will take longer &amp;amp; the untar will be absolute! &lt;BR /&gt;&lt;BR /&gt;Lastly make sure before doing the above that the RCMO files will end up in the right disks/LV's else you'll fill up the wrong filesystem &lt;BR /&gt;&lt;BR /&gt;I hope it all helps &lt;BR /&gt;&lt;BR /&gt;Tim&lt;/FILESYS&gt;&lt;/FILESYS&gt;&lt;/FILESYS&gt;&lt;/FILESYS&gt;</description>
      <pubDate>Sat, 06 Oct 2001 14:42:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590681#M725629</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2001-10-06T14:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590682#M725630</link>
      <description>Unfortunately tar can not append to an archive if the archive doesn't already exist, so I think Ramesh's script would have a problem.&lt;BR /&gt;&lt;BR /&gt;A workaround could be to get the list of files, again using the find command, and then creating the tar file at one shot, i.e.:&lt;BR /&gt;&lt;BR /&gt;find /hpm* -name RCMO\* &amp;gt; archive.lst&lt;BR /&gt;tar cvf mydbf.tar $(cat archive.lst)&lt;BR /&gt;&lt;BR /&gt;also you may want to consider compressing the archive so that it would be faster when you try to transfer it to another system, i.e.:&lt;BR /&gt;&lt;BR /&gt;find /hpm* -name RCMO\* &amp;gt; archive.lst&lt;BR /&gt;tar cvf - $(cat archive.lst)|gzip -c &amp;gt; mydbf.tar.gz&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;-Santosh&lt;BR /&gt;</description>
      <pubDate>Sat, 06 Oct 2001 14:43:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590682#M725630</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-10-06T14:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590683#M725631</link>
      <description>Hello Subbu,&lt;BR /&gt;&lt;BR /&gt;just a simple mixture of "find" and "tar" and&lt;BR /&gt;"ftp" should be fine:&lt;BR /&gt;&lt;BR /&gt;tar cvf /tmp/all.tar $(find /hpm30 /hpm31 /hpm32 -name "RCMO*")&lt;BR /&gt;&lt;BR /&gt;and then "ftp" it over and "tar xvf" it over&lt;BR /&gt;there.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
      <pubDate>Sat, 06 Oct 2001 16:35:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590683#M725631</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-10-06T16:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590684#M725632</link>
      <description>Subbu,&lt;BR /&gt;&lt;BR /&gt;You can also try this simple way.&lt;BR /&gt;&lt;BR /&gt;tar cvf /tmp/RCM.tar /hpm*/RCM*&lt;BR /&gt;&lt;BR /&gt;FTP /tmp/RCM.tar to system B&lt;BR /&gt;&lt;BR /&gt;and do &lt;BR /&gt;&lt;BR /&gt;a tar xvf /tmp/RCM.tar&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 06 Oct 2001 16:57:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590684#M725632</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-06T16:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590685#M725633</link>
      <description>If this is a one-time task then the above suggestions should work if you have enough space to hold the tar archive.&lt;BR /&gt;&lt;BR /&gt;However, if this is a regular task and (some of) these files are large then you could use a batch ftp to accomplish this task (assumptions: both systems have the named directories in $DIRS):&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;# replicate RCMO files in system B&lt;BR /&gt;&lt;BR /&gt;REMOTECPU="myname.domain.com"&lt;BR /&gt;USER=somelogin&lt;BR /&gt;PW=somePW &lt;BR /&gt;DIRS="/hpm30 /hpm31 /hpm32"&lt;BR /&gt;&lt;BR /&gt;for MYDIR in 30 31 32&lt;BR /&gt;do&lt;BR /&gt;/usr/bin/ftp -n -v &amp;lt;&amp;lt; EOF&lt;BR /&gt;open $REMOTECPU&lt;BR /&gt;user $USER $PW&lt;BR /&gt;lcd $DIRS&lt;BR /&gt;cd $DIRS&lt;BR /&gt;prompt&lt;BR /&gt;binary&lt;BR /&gt;mput RCMO\*&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;&lt;BR /&gt;The RCMO\* needs the \* to prevent the shell's file matching from substituting anything in the local directory where the script is run. We want ftp to see the *, not the shell, since ftp must perform the match.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 06 Oct 2001 18:39:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590685#M725633</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2001-10-06T18:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590686#M725634</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;My suggestion would work if you are using gnu tar, but since that is not a valid assumption i guess you will have to create a list of contents or use one of the other suggestions.&lt;BR /&gt;&lt;BR /&gt;Also i would like to add, you are better of compressing the tar file, to reduce the data to be transfered. Ofcourse you can script all this in one script, to tar, compress, ftp and then telnet to the other system, uncompress and untar the file and remove the tar file after the untar.&lt;BR /&gt;&lt;BR /&gt;-Regards&lt;BR /&gt;Ramesh</description>
      <pubDate>Sun, 07 Oct 2001 17:46:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590686#M725634</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-10-07T17:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590687#M725635</link>
      <description>Hi Subbu,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is a script that you can modify or use it as it is to tar,uncompress, ftp , telnet to the remote machine, uncompress/untar the file and then delete the tar file on the remote/local machine.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/Begin/&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;PATH=/usr/bin:/usr/contrib/bin&lt;BR /&gt;&lt;BR /&gt;# Here remote is your remote host&lt;BR /&gt;REMOTE=remote&lt;BR /&gt;&lt;BR /&gt;# user is the user you want to ftp as&lt;BR /&gt;USER=user&lt;BR /&gt;&lt;BR /&gt;# password of the user&lt;BR /&gt;PW=password&lt;BR /&gt;&lt;BR /&gt;# Here /hpm3 can be an absolute path /path/to/hpm3,&lt;BR /&gt;DIR=/hpm3&lt;BR /&gt;&lt;BR /&gt;# Files you want to copy to remote host&lt;BR /&gt;FILE=RCMO*.dbf&lt;BR /&gt;&lt;BR /&gt;# Name of the tar file&lt;BR /&gt;MYTAR=mydbf.tar&lt;BR /&gt;&lt;BR /&gt;#### Do not need to edit below #####&lt;BR /&gt;&lt;BR /&gt;echo " ### Creating the tar file  ### "&lt;BR /&gt;tar cvf $MYTAR /$DIR*/$FILE&lt;BR /&gt;echo " ### Compressing the tar file  ### "&lt;BR /&gt;gzip $MYTAR&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;echo "### Transferring the compressed tar file to $REMOTE host ###"&lt;BR /&gt;ftp  -n -v &amp;lt;&amp;lt; EOF&lt;BR /&gt;open $REMOTE&lt;BR /&gt;user $USER $PW&lt;BR /&gt;cd $DIR&lt;BR /&gt;prompt&lt;BR /&gt;binary&lt;BR /&gt;put $MYTAR.gz&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;echo "### Logging into the remote host for uncompressing/untarring the file ###"&lt;BR /&gt;(sleep 5&lt;BR /&gt;echo $USER&lt;BR /&gt;sleep 5&lt;BR /&gt;echo $PW&lt;BR /&gt;sleep 15&lt;BR /&gt;echo "gzip -dc $DIR/$MYTAR.gz | tar xvf - "&lt;BR /&gt;echo "rm $DIR/$MYTAR.gz"&lt;BR /&gt;echo exit) |telnet $REMOTE&lt;BR /&gt;&lt;BR /&gt;echo "### Deleting the  tar file on local host ###"&lt;BR /&gt;rm $MYTAR.gz&lt;BR /&gt;&lt;BR /&gt;/End/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh&lt;BR /&gt;</description>
      <pubDate>Sun, 07 Oct 2001 18:03:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-script/m-p/2590687#M725635</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-10-07T18:03:50Z</dc:date>
    </item>
  </channel>
</rss>

