<?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: Checking FTP Transfers in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092281#M145091</link>
    <description>It's probably not accurate enough, but I have a script that performs a regular ftp session and a quick evaluation of the result (this one just checks for one file, so take the wc -l out for multiple files, and search for "Failed";&lt;BR /&gt;&lt;BR /&gt;ftp -v &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;open xxxxx&lt;BR /&gt;cd xxxx&lt;BR /&gt;lcd $CTNL_DIR&lt;BR /&gt;put $_FTPFILE&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;_FTPRESULT=`grep -i "Transfer complete" $_FTPCHECK | wc -l`&lt;BR /&gt;        if [ $_FTPRESULT = 1 ]&lt;BR /&gt;        then&lt;BR /&gt;        echo "FTP of XML file worked OK" | tee -a $LOGFILE&lt;BR /&gt;        return 0&lt;BR /&gt;        else&lt;BR /&gt;        mailx -s "Alert from `hostname` failed to be FTP'd to xxxx at `date`"&lt;BR /&gt;         return 1&lt;BR /&gt;        fi</description>
    <pubDate>Tue, 14 Oct 2003 02:06:08 GMT</pubDate>
    <dc:creator>Brendan Newport_2</dc:creator>
    <dc:date>2003-10-14T02:06:08Z</dc:date>
    <item>
      <title>Checking FTP Transfers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092279#M145089</link>
      <description>I have written the following script file to automate a daily transfering files using VPN. For some reason, some files are not successfuly transfered. I run a cron job every minute and forward the output. How I can automate the check for failures in file transfer? &lt;BR /&gt;cd /appl/&lt;BR /&gt;ls LKL* | read LINE&lt;BR /&gt;ftp -n x.x.x.x &amp;lt;&amp;lt; EOF&lt;BR /&gt;user xxxxx xxxxx&lt;BR /&gt;type ascii&lt;BR /&gt;prompt&lt;BR /&gt;hash&lt;BR /&gt;put $LINE&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;echo $LINE&lt;BR /&gt;date&lt;BR /&gt;mv $LINE /home/backup_out&lt;BR /&gt;the cron is :&lt;BR /&gt;* 17-22 * * * /home/taut.sh &amp;gt;&amp;gt; /home/taut.log&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Oct 2003 01:29:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092279#M145089</guid>
      <dc:creator>Fuad_1</dc:creator>
      <dc:date>2003-10-14T01:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Checking FTP Transfers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092280#M145090</link>
      <description>The only surefire way of doing this is to compare the files after the transfer as in&lt;BR /&gt; &lt;BR /&gt;remsh machine2 cat $LINE | cmp - $LINE&lt;BR /&gt; &lt;BR /&gt;You can test the output of this. i.e. if there is any output, the transfer failed.</description>
      <pubDate>Tue, 14 Oct 2003 01:39:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092280#M145090</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-14T01:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Checking FTP Transfers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092281#M145091</link>
      <description>It's probably not accurate enough, but I have a script that performs a regular ftp session and a quick evaluation of the result (this one just checks for one file, so take the wc -l out for multiple files, and search for "Failed";&lt;BR /&gt;&lt;BR /&gt;ftp -v &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;open xxxxx&lt;BR /&gt;cd xxxx&lt;BR /&gt;lcd $CTNL_DIR&lt;BR /&gt;put $_FTPFILE&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;_FTPRESULT=`grep -i "Transfer complete" $_FTPCHECK | wc -l`&lt;BR /&gt;        if [ $_FTPRESULT = 1 ]&lt;BR /&gt;        then&lt;BR /&gt;        echo "FTP of XML file worked OK" | tee -a $LOGFILE&lt;BR /&gt;        return 0&lt;BR /&gt;        else&lt;BR /&gt;        mailx -s "Alert from `hostname` failed to be FTP'd to xxxx at `date`"&lt;BR /&gt;         return 1&lt;BR /&gt;        fi</description>
      <pubDate>Tue, 14 Oct 2003 02:06:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092281#M145091</guid>
      <dc:creator>Brendan Newport_2</dc:creator>
      <dc:date>2003-10-14T02:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Checking FTP Transfers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092282#M145092</link>
      <description>It could be that your script does something you did not intend.&lt;BR /&gt;If you have more than one file whose name begins LKL, your script will only pick up the first one.&lt;BR /&gt;There are a number of ways round this.&lt;BR /&gt;eg - use "mput LKL*" instead of "put $LINE". This is the easiest to script.&lt;BR /&gt;Or you could use "ls -1" to generate a list of files and process them one at a time.&lt;BR /&gt;--&lt;BR /&gt;In terms of capturing FTP session output, as per previous post, capture session output using "ftp -n x.x.x.x &amp;lt;&amp;lt; EOF &amp;gt;LOG 2&amp;gt;$1" and use grep to check the log file.&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Oct 2003 05:54:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092282#M145092</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-14T05:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Checking FTP Transfers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092283#M145093</link>
      <description>Rather than doing silly stuff with commands after the fact, the far better way is to test as each file is transferred and possibly automatically attempt a re-transmit. Perl's Net::FTP module makes this trivially easy. Perl 5.6.1 that ships with current HP-UX already has the module but if using earlier versions then you will need to download and install the Net::FTP module from &lt;A href="http://www.perl.org/CPAN." target="_blank"&gt;www.perl.org/CPAN.&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;All you have to do, is&lt;BR /&gt;ftpput.pl file1 file2 file3 and modify the code to do the appropriate cd's and logins. &lt;BR /&gt;Net::FTP also recoginizes .netrc conventions so that you don't even have to put passwords in the script -- the comments are in the code.&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;ftpput.pl file1 file2 file3&lt;BR /&gt;STAT=${?}&lt;BR /&gt;&lt;BR /&gt;if ${STAT} is zero, you KNOW all the file transfers were ok.&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Oct 2003 08:57:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-ftp-transfers/m-p/3092283#M145093</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-10-14T08:57:05Z</dc:date>
    </item>
  </channel>
</rss>

