<?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: FTP status in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052906#M304804</link>
    <description>Trying to do this in the shell is very tedious and FTP's error codes mean different things at different times. It's MUCH easier to do it in Perl and you get error checking for free. The attached script, ftpput.pl, will ftp to host "mouse" as user "mickey", password "secret", cd to /aaa/bbb, set ASCII mode, try every file up to 3 times, and put file1, file2, and file3. It will even read the password from a .netrc file so that it doesn't have to be passed on the command line. You don't have to know any Perl at all. All you have to do is test the exit status. If it's 0, all went well otherwise a non-zero exit code is set and an error message is output on stderr.&lt;BR /&gt;&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;ftpput.pl -h mouse -l mickey -p secret \&lt;BR /&gt;  -d /aaa/bbb -A -h 3 file1 file2 file3&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -ne 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Ftp failed; status ${STAT}." &amp;gt;&amp;amp;2&lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;&lt;BR /&gt;Invoke as ftpput.pl -u for full usage.&lt;BR /&gt;</description>
    <pubDate>Thu, 09 Aug 2007 18:56:30 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2007-08-09T18:56:30Z</dc:date>
    <item>
      <title>FTP status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052904#M304802</link>
      <description>Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I am getting/putting the file from remote server then i delete the file from my server.&lt;BR /&gt;&lt;BR /&gt;I want to check the status before i delete or moved the file from server. I want to check if any "Login failed" and "host not connect" error through scripts. I found that if it ftp return "221"  means it exits from the ftp session wheather it is successful or "Login failed" but for "host not connect" it want display any number.&lt;BR /&gt;&lt;BR /&gt;I want to check through "if" condition. Can you please tell me how i can check the condition in scripts.&lt;BR /&gt;&lt;BR /&gt;Pls find the following scripts which doesn't check proprly.&lt;BR /&gt;&lt;BR /&gt;T1=`grep "221  " FTPLOGOUT` &lt;BR /&gt;T2=`grep "Login failed" $FTPLOGOUT`&lt;BR /&gt;if [ "$T1" -eq "221  " ]  &lt;BR /&gt;  then&lt;BR /&gt;    if [ "$T2" -ne "Login failed." ]&lt;BR /&gt;     then &lt;BR /&gt;       rm *&lt;BR /&gt;       echo "FTP Done"      &lt;BR /&gt;    else                              &lt;BR /&gt;      echo "FTP Failed : Login Failed(cbpout)" &amp;gt;&amp;gt; $MAILLOG &lt;BR /&gt;    fi                                  else                                          echo "FTP failed : Host not connected(cbpout)" &amp;gt;&amp;gt; $MAILLOG&lt;BR /&gt;fi  &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Manish</description>
      <pubDate>Thu, 09 Aug 2007 17:00:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052904#M304802</guid>
      <dc:creator>MANISH PATEL_2</dc:creator>
      <dc:date>2007-08-09T17:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: FTP status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052905#M304803</link>
      <description>Hi Manish,&lt;BR /&gt;&lt;BR /&gt;You should seriously think about rewriting your script in Perl, and use the Net::FTP module.&lt;BR /&gt;&lt;BR /&gt;It will be far more stable.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://search.cpan.org/~gbarr/libnet-1.21/Net/FTP.pm" target="_blank"&gt;http://search.cpan.org/~gbarr/libnet-1.21/Net/FTP.pm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Rob</description>
      <pubDate>Thu, 09 Aug 2007 17:54:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052905#M304803</guid>
      <dc:creator>Rob Leadbeater</dc:creator>
      <dc:date>2007-08-09T17:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: FTP status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052906#M304804</link>
      <description>Trying to do this in the shell is very tedious and FTP's error codes mean different things at different times. It's MUCH easier to do it in Perl and you get error checking for free. The attached script, ftpput.pl, will ftp to host "mouse" as user "mickey", password "secret", cd to /aaa/bbb, set ASCII mode, try every file up to 3 times, and put file1, file2, and file3. It will even read the password from a .netrc file so that it doesn't have to be passed on the command line. You don't have to know any Perl at all. All you have to do is test the exit status. If it's 0, all went well otherwise a non-zero exit code is set and an error message is output on stderr.&lt;BR /&gt;&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;ftpput.pl -h mouse -l mickey -p secret \&lt;BR /&gt;  -d /aaa/bbb -A -h 3 file1 file2 file3&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -ne 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Ftp failed; status ${STAT}." &amp;gt;&amp;amp;2&lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;&lt;BR /&gt;Invoke as ftpput.pl -u for full usage.&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2007 18:56:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052906#M304804</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-09T18:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: FTP status</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052907#M304805</link>
      <description>... and here is ftpget.pl. Invoke as ftpget.pl -u for full usage. The really good news is that if you have Perl installed on a Windows box, the Perl scripts work equally well there as well as on UNIX.&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2007 18:58:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-status/m-p/4052907#M304805</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-09T18:58:14Z</dc:date>
    </item>
  </channel>
</rss>

