<?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: script wanted in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233910#M329018</link>
    <description>Though, as Kevin suggested the evaluation of the SSH command's return code may suffice most of the times,&lt;BR /&gt;I have always implemented additionally in my scripts which involve any sort of transfer between hosts (usually by SSH) a postprocessing that compares the check sums or a hash digest taken of the files on the source system with those after successful transfer on the target system.&lt;BR /&gt;This is simply comparing two strings of the output from a command like cksum or md5sum for instance.&lt;BR /&gt;Most scripting languages also have custom modules with function or method calls for these calculations.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 16 Jul 2008 11:35:24 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2008-07-16T11:35:24Z</dc:date>
    <item>
      <title>script wanted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233907#M329015</link>
      <description>I have two servers , sometimes they have problem to transfer files ( may be the connection problem ), so sometimes there are some files did not transferred to remote site ( one direction only , from server A to server B ) , so I would like to have a script to check if the files are sucessfully transferred , the condition of the checking is as below  :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;when found a new .err extension file in /tmp , then wait 5 minutes ( because assume the file transfer need 5 minutes ) , and then check the files in directory /ora in both server are the same or not ( only check the files that are created within 30 minutes because there is another script will copy the file to server B in every 30 minutes  ) , if any file in server A have but server B do not , then notify me which file is not transferred , in simply , what I want to check is the files ( created within 30 minutes ) in both server are exist or not when the .err file found , if any transfer problem , then notify me , could provide the script ?&lt;BR /&gt;&lt;BR /&gt;thx</description>
      <pubDate>Tue, 15 Jul 2008 07:04:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233907#M329015</guid>
      <dc:creator>haeman</dc:creator>
      <dc:date>2008-07-15T07:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: script wanted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233908#M329016</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Just a thought. I am not good at scripting. Trying to give a simple draft. Hope its matching your criteria.&lt;BR /&gt;&lt;BR /&gt;1- Enter IF loop if .err exist&lt;BR /&gt;   use ls /tmp | grep -i err&lt;BR /&gt;&lt;BR /&gt;2- under IF loop&lt;BR /&gt;   chk files exists or not on both servers&lt;BR /&gt;   use -mtime with find.&lt;BR /&gt;   If yes then&lt;BR /&gt;   check chksum for both files &lt;BR /&gt;   If match then all good&lt;BR /&gt;   If not throw error mail using mailx.</description>
      <pubDate>Tue, 15 Jul 2008 07:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233908#M329016</guid>
      <dc:creator>Shrikant Lavhate</dc:creator>
      <dc:date>2008-07-15T07:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: script wanted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233909#M329017</link>
      <description>What are you using to transfer the files?&lt;BR /&gt;&lt;BR /&gt;If using scp you can capture the return code&lt;BR /&gt;EXIT STATUS&lt;BR /&gt;  0       Operation was successful.&lt;BR /&gt;  1, 2    Operation resulted in an undetermined error within sshfilecopy.&lt;BR /&gt;  3       Destination is not directory, but it should be.&lt;BR /&gt;  4       Connection to host failed.&lt;BR /&gt;  5       Connection lost.&lt;BR /&gt;  6       File does not exist.&lt;BR /&gt;  7       No permission to access file&lt;BR /&gt;  8       Undetermined error from sshfilexfer.&lt;BR /&gt;  9       File transfer protocol mismatch.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;EXAMPLES&lt;BR /&gt;&lt;BR /&gt;The following example shows how to copy files from your local system to a remote system:&lt;BR /&gt;&lt;BR /&gt;prompt&amp;gt;scp localfile user@remotehost:/dest/&lt;BR /&gt;&lt;BR /&gt;If used in a script after the command capture the error code:&lt;BR /&gt;&lt;BR /&gt; typeset -i RC  # Create integer variable&lt;BR /&gt;                # put at beginning of script&lt;BR /&gt;&lt;BR /&gt; RC=$? # Put immediately after command&lt;BR /&gt;&lt;BR /&gt;Then check the error code:&lt;BR /&gt;&lt;BR /&gt;if [ ${RC} -eq 0 ] ; then&lt;BR /&gt;    echo "Operation succeeded"  &lt;BR /&gt;else&lt;BR /&gt;    echo "There's been an error" | mailx -s "Subject" mail.recipient@somewhere.ca&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;RC=0 # Reset the variable if you're putting into a loop&lt;BR /&gt;&lt;BR /&gt;I used echo statements to indicate where you'd put the commands you'd like to run after the copy based on the success/failure.&lt;BR /&gt;&lt;BR /&gt;I didn't do a compare of the files after because if SCP has a return code of 0 then the file from the Source is definately on the Destination server.&lt;BR /&gt;&lt;BR /&gt;Note this is KSH script syntax.&lt;BR /&gt;&lt;BR /&gt;What tools do you have available to you to look at the directory contents on the remote server(s)?  Can you SSH to/from each server?</description>
      <pubDate>Tue, 15 Jul 2008 08:37:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233909#M329017</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-07-15T08:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: script wanted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233910#M329018</link>
      <description>Though, as Kevin suggested the evaluation of the SSH command's return code may suffice most of the times,&lt;BR /&gt;I have always implemented additionally in my scripts which involve any sort of transfer between hosts (usually by SSH) a postprocessing that compares the check sums or a hash digest taken of the files on the source system with those after successful transfer on the target system.&lt;BR /&gt;This is simply comparing two strings of the output from a command like cksum or md5sum for instance.&lt;BR /&gt;Most scripting languages also have custom modules with function or method calls for these calculations.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Jul 2008 11:35:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wanted/m-p/4233910#M329018</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-07-16T11:35:24Z</dc:date>
    </item>
  </channel>
</rss>

