<?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 ftp script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639354#M43249</link>
    <description>Hi Folks,&lt;BR /&gt;&lt;BR /&gt;I am running a script in cron which check the dir, if the directory is empty the script exit otherwise start ftp, when the ftp done it will mv the files to done dir. Now what i want is that if the ftp connect drop by any reason it won't mv the files. But when the ftp session starts, I kill the session from the other service to check if its mv the files, and the script doing so, any suggestion.&lt;BR /&gt;&lt;BR /&gt;Here's my script:&lt;BR /&gt;&lt;BR /&gt; #!/bin/sh&lt;BR /&gt;cd /home/akhan/testdir&lt;BR /&gt;file=`find . -type f -print |wc -l`&lt;BR /&gt;if [ $file -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;exit 1&lt;BR /&gt;else&lt;BR /&gt;ftp -inv transrva &amp;lt;&lt;ENDFTP&gt;&lt;/ENDFTP&gt;user user passwd&lt;BR /&gt;bin&lt;BR /&gt;lcd /home/akhan&lt;BR /&gt;cd /home/akhan/ftp.sh&lt;BR /&gt;mput *&lt;BR /&gt;bye&lt;BR /&gt;EndFTP&lt;BR /&gt;fi&lt;BR /&gt;error_code=$?&lt;BR /&gt;if [ $error_code -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;filename=" "&lt;BR /&gt;for filename in `ls`&lt;BR /&gt;do&lt;BR /&gt;sleep 20&lt;BR /&gt;mv $filename /home/akhan/done$filename `date +%Y.%m.%d`&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Thanxs &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 04 Jan 2002 20:48:55 GMT</pubDate>
    <dc:creator>Anthony khan</dc:creator>
    <dc:date>2002-01-04T20:48:55Z</dc:date>
    <item>
      <title>ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639354#M43249</link>
      <description>Hi Folks,&lt;BR /&gt;&lt;BR /&gt;I am running a script in cron which check the dir, if the directory is empty the script exit otherwise start ftp, when the ftp done it will mv the files to done dir. Now what i want is that if the ftp connect drop by any reason it won't mv the files. But when the ftp session starts, I kill the session from the other service to check if its mv the files, and the script doing so, any suggestion.&lt;BR /&gt;&lt;BR /&gt;Here's my script:&lt;BR /&gt;&lt;BR /&gt; #!/bin/sh&lt;BR /&gt;cd /home/akhan/testdir&lt;BR /&gt;file=`find . -type f -print |wc -l`&lt;BR /&gt;if [ $file -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;exit 1&lt;BR /&gt;else&lt;BR /&gt;ftp -inv transrva &amp;lt;&lt;ENDFTP&gt;&lt;/ENDFTP&gt;user user passwd&lt;BR /&gt;bin&lt;BR /&gt;lcd /home/akhan&lt;BR /&gt;cd /home/akhan/ftp.sh&lt;BR /&gt;mput *&lt;BR /&gt;bye&lt;BR /&gt;EndFTP&lt;BR /&gt;fi&lt;BR /&gt;error_code=$?&lt;BR /&gt;if [ $error_code -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;filename=" "&lt;BR /&gt;for filename in `ls`&lt;BR /&gt;do&lt;BR /&gt;sleep 20&lt;BR /&gt;mv $filename /home/akhan/done$filename `date +%Y.%m.%d`&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Thanxs &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Jan 2002 20:48:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639354#M43249</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2002-01-04T20:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639355#M43250</link>
      <description>the exit code from ftp just tells you if ftp started and stopped ok, not if there were any errors during the connection.  You have to route standard error from the ftp process to a log file and grep for the error numbers and key phrases (not all the errors are displayed with their numbers) to determine if the file were sent ok or not.&lt;BR /&gt;&lt;BR /&gt;I posted a solution for this about a month ago. I the search function is cooperating today, I will try to dig-up the link to it and post it for you.&lt;BR /&gt;&lt;BR /&gt;mark</description>
      <pubDate>Fri, 04 Jan 2002 20:55:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639355#M43250</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2002-01-04T20:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639356#M43251</link>
      <description>Hi Anthony:&lt;BR /&gt;&lt;BR /&gt;Hi Adam: &lt;BR /&gt;&lt;BR /&gt;In the past, I used to do this stuff in the shell but now I NEVER do because I have found a much cleaner way to do it that makes error trapping duck soup. Do this stuff in Perl using the Net::FTP module which is available from &lt;A href="http://www.cpan.org" target="_blank"&gt;http://www.cpan.org&lt;/A&gt; . &lt;BR /&gt;&lt;BR /&gt;Here's how simple it can be: &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl -w &lt;BR /&gt;&lt;BR /&gt;use Net::FTP; &lt;BR /&gt;use strict; &lt;BR /&gt;&lt;BR /&gt;my $ftp = Net::FTP-&amp;gt;new("remotehost",Debug =&amp;gt; 0); &lt;BR /&gt;$ftp-&amp;gt;login("cstephen","top_secret"); &lt;BR /&gt;$ftp-&amp;gt;cwd("/tmp"); &lt;BR /&gt;$ftp-&amp;gt;get("myfile"); &lt;BR /&gt;my $stat = $ftp-&amp;gt;status; &lt;BR /&gt;my $full_stat = $ftp-&amp;gt;code; &lt;BR /&gt;# $stat contains the first digit; usually all &lt;BR /&gt;# that you need to do is test if it is equal &lt;BR /&gt;# to 2. $full_stat contains the full 3-digit &lt;BR /&gt;# value but is seldom needed &lt;BR /&gt;printf("Status: %d Full Status: %d\n",$stat,$full_stat); &lt;BR /&gt;# Sample Test &lt;BR /&gt;if ($stat == 2) &lt;BR /&gt;{ &lt;BR /&gt;print "Get was good\n"; &lt;BR /&gt;} &lt;BR /&gt;else &lt;BR /&gt;{ &lt;BR /&gt;print "Get was bad\n"; &lt;BR /&gt;} &lt;BR /&gt;$ftp-&amp;gt;quit; &lt;BR /&gt;&lt;BR /&gt;I think if you start using this module you will never go back to shell scripting FTP. Moreover, these same scripts will run in the NT world. &lt;BR /&gt;&lt;BR /&gt;Notice that this method easily handles the error checking. If you like, you can use the shell for most of your script and simply use a bit a perl for the actual FTP transfers. In that case add the statement exit($stat) to the perl script and then your shell script does have a valid status indication.&lt;BR /&gt;&lt;BR /&gt;Now, if it were me I would do it all in Perl but that's just my blind and simple approach.&lt;BR /&gt;&lt;BR /&gt;Food for thought, Clay &lt;BR /&gt;</description>
      <pubDate>Fri, 04 Jan 2002 21:02:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639356#M43251</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-01-04T21:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639357#M43252</link>
      <description>&lt;BIG soapbox=""&gt;I've been fighting this kind of backwards thinking for many years. it's been my opinion that when a file is ready to be retreived, that the process that created the file is the process that should be SENDING the file. It's such a waste of resources to spin on retreiving a file, when the remote process that created the file knows that it is ready to be sent. &lt;/BIG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Fri, 04 Jan 2002 21:06:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639357#M43252</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-01-04T21:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639358#M43253</link>
      <description>For applications like this I use rcp rather than ftp.  It is a lot easier to script, it uses less bandwidth on your network and uses fewer clock cycles on both ends.  It also means that you don't have to hardcode the password into the script.  &lt;BR /&gt;&lt;BR /&gt;Also, once having copied the file, use sum -r to do a checksum, and compare it with the checksum on the source.  This ensures that your file arrived intact--regardless of how long it took to copy or how many errors were encountered along the way.  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Fri, 04 Jan 2002 21:24:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639358#M43253</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2002-01-04T21:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639359#M43254</link>
      <description>Hello Anthony,&lt;BR /&gt;&lt;BR /&gt;you could use "scp" instead of "ftp" or "rcp" to be on the save side...&lt;BR /&gt;&lt;BR /&gt;But for your "ftp" scripting, why not do this on the client side:&lt;BR /&gt;&lt;BR /&gt;Move that "mv" command into your list of "ftp" commands using the "!" (bang) notation - if your "ftp" is broken, htat "mv" will NOT be executed!&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
      <pubDate>Sat, 05 Jan 2002 02:08:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639359#M43254</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2002-01-05T02:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639360#M43255</link>
      <description>Hi Harry, &lt;BR /&gt;I agree with you, but the thing is that we getting the file from differen banks to process, so banks are ftp the files in ftp server.&lt;BR /&gt;&lt;BR /&gt;Anyway thanxs guys for ur help</description>
      <pubDate>Mon, 07 Jan 2002 14:13:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639360#M43255</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2002-01-07T14:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639361#M43256</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Banks are using FTP?! *faint on the spot* This forum is not for the faint-hearted.&lt;BR /&gt;&lt;BR /&gt;Which bank is that? I won't want to deposit money in such a bank :P&lt;BR /&gt;&lt;BR /&gt;FTP transmits data in the clear and is vulnerable to spoofing, hijacking and data sniffing attacks to name just a few.&lt;BR /&gt;&lt;BR /&gt;Why are you still using FTP?&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Thu, 24 Jan 2002 02:47:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639361#M43256</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-01-24T02:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639362#M43257</link>
      <description>Anthony,&lt;BR /&gt;&lt;BR /&gt;I was a developer for a bank  and then a banking software company (specializing in ATM's, ACH, EDI, Teller Terminals, Check Sorters, data file transmissions, and yes, unix) for almost 10 years, and that's where I TAUGHT other banks, the IRS, state agencies, and other vendors HOW data was to be transmitted. &lt;BR /&gt;&lt;BR /&gt;Steven, What Anthony is using is a semi-secure private network within the financial community, probably something I'll be using soon. The network really isn't BankA sending data directly to BankB, what happens is that BankA sends their data to a REPOSITORY (some call it a mail box), where then BankB can go get it. Only BankA can see BankA's "private" network, and the same is true for everyone else. Now I agree that if you have not encrypted your data, that you run the risk of hijacking, and if I was the developer, I'd be slapping people into shape that, yes the data would be encrypted. But, hell, a few years ago, I could have created an ACH tape, and sent it to almost any bank and it would have been processed. Fortunately, things have changed, and security in banks is getting better, but I'm sure I could empty most ATM's with very little work: wire cutters, a PC, some extra wire, and a lot of stupidity (it's a federal crime!).&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 24 Jan 2002 03:24:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ftp-script/m-p/2639362#M43257</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-01-24T03:24:12Z</dc:date>
    </item>
  </channel>
</rss>

