<?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: Testing filesize in posix in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714723#M61455</link>
    <description>Say if you got these files coming into a "common" location or directory. Aprat from check the file size overtime to make sure they stabalized you can add one more check ie the file count in that directory. If it increases by 1, then you know the next file in being ftp into this directory, and you can proceed with processing the previous file.</description>
    <pubDate>Wed, 01 May 2002 11:41:35 GMT</pubDate>
    <dc:creator>S.K. Chan</dc:creator>
    <dc:date>2002-05-01T11:41:35Z</dc:date>
    <item>
      <title>Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714719#M61451</link>
      <description>Hello all,&lt;BR /&gt;   An interesting problem I have run into. I will give you a general overview so as not to bore anyone.&lt;BR /&gt;&lt;BR /&gt;I receive files via ftp all day long. Upon receipt I must then send them out via dialup. The last step of automating the process is an apparently simple script that simply waits for the file size to stablize and remain constant for a certain period of time to avoid sending out partial files.&lt;BR /&gt;&lt;BR /&gt;I am certain I am not the only person who has run across this problem. Suggestions anyone?&lt;BR /&gt;&lt;BR /&gt;jiin</description>
      <pubDate>Wed, 01 May 2002 11:30:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714719#M61451</guid>
      <dc:creator>Gerald Bush_2</dc:creator>
      <dc:date>2002-05-01T11:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714720#M61452</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You could use fuser or lsof to see if the file was in use.&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Wed, 01 May 2002 11:35:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714720#M61452</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2002-05-01T11:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714721#M61453</link>
      <description>Hi Gerald:&lt;BR /&gt;&lt;BR /&gt;You could use 'wc -c' to assay the size of the file in characters.  Capture the value; sleep for a short period; retest; and if the value is the same, consider the process done; otherwise repeat the loop.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 May 2002 11:36:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714721#M61453</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-05-01T11:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714722#M61454</link>
      <description>Gerald,&lt;BR /&gt;&lt;BR /&gt;'fuser' works, you can code it thus:-&lt;BR /&gt;&lt;BR /&gt;if [[ -n $(fuser &lt;FILENAME&gt; 2&amp;gt;/dev/null ]];&lt;BR /&gt;then &lt;IT&gt;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;BR /&gt;&lt;/IT&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 01 May 2002 11:41:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714722#M61454</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-05-01T11:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714723#M61455</link>
      <description>Say if you got these files coming into a "common" location or directory. Aprat from check the file size overtime to make sure they stabalized you can add one more check ie the file count in that directory. If it increases by 1, then you know the next file in being ftp into this directory, and you can proceed with processing the previous file.</description>
      <pubDate>Wed, 01 May 2002 11:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714723#M61455</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2002-05-01T11:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714724#M61456</link>
      <description>Gerald,&lt;BR /&gt;&lt;BR /&gt;For POSIX shell documentation on checking filesizes use:&lt;BR /&gt;&lt;BR /&gt;man sh-posix&lt;BR /&gt;&lt;BR /&gt;and use "lsof filename" to see if anyone has it open!&lt;BR /&gt;&lt;BR /&gt;*************************&lt;BR /&gt;If you recieve these files from some automated process have that process modified to do this (I've been doing this for over 10 years now without any issues):&lt;BR /&gt;&lt;BR /&gt;Data file is received, with some conventional naming like &lt;FILENAME&gt;.dat, and upon completion of sending the data file, the sending process is to write a blank file with the same PREFIX but with a suffix of .RDY.&lt;BR /&gt;&lt;BR /&gt;Here is an example:&lt;BR /&gt;&lt;BR /&gt;Sender sends the file banktrans_20020501.dat&lt;BR /&gt;&lt;BR /&gt;when it is done, the sender sends a blank file, or even with some useful info in it:&lt;BR /&gt;&lt;BR /&gt;banktrans_20020501.rdy&lt;BR /&gt;&lt;BR /&gt;The receiver ONLY looks for files that match "*\.rdy" to be processed.&lt;BR /&gt;&lt;BR /&gt;Saves everyone a lot of headaches!!!&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry&lt;BR /&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 01 May 2002 11:43:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714724#M61456</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-05-01T11:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714725#M61457</link>
      <description>Another alternative if you have control over the sending process is to send it as a filename that your receiving process ignores and finally rename it e.g.:&lt;BR /&gt;&lt;BR /&gt;put &lt;TEMPNAME&gt;&lt;BR /&gt;rename &lt;TEMPNAME&gt; &lt;REALNAME&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John&lt;/REALNAME&gt;&lt;/TEMPNAME&gt;&lt;/TEMPNAME&gt;</description>
      <pubDate>Wed, 01 May 2002 11:54:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714725#M61457</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-05-01T11:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714726#M61458</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Rather than looking at filesize a better way is to see if the file has been modified in some period of time. The attached perl script will do the trick:&lt;BR /&gt;&lt;BR /&gt;SECONDS=60&lt;BR /&gt;FILENAME=myfile.dat&lt;BR /&gt;&lt;BR /&gt;fileage.pl -m -s ${SECONDS} ${FILENAME}&lt;BR /&gt;STAT=$?&lt;BR /&gt;if [ ${STAT} -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;  echo "${FILENAME} has not been modified in"&lt;BR /&gt;  echo "the last ${SECONDS} seconds."&lt;BR /&gt;  echo "It is safe to copy."&lt;BR /&gt;else&lt;BR /&gt;  echo "${FILENAME} is not safe to copy."&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;The script silently report whether or not a file has been modified. fileage.pl -u gives full usage.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 May 2002 12:06:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714726#M61458</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-05-01T12:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Testing filesize in posix</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714727#M61459</link>
      <description>Thanks everyone for all the help. The solution will be to use the *.rdy empty file method as this avoids any network hiccups. The fuser solution is viable also and the code helped especially. I will use that in the future.&lt;BR /&gt;&lt;BR /&gt;Normally LSOF would have been one of my first thoughts, however 11i doesn't always like to compile the 11.00 depot applications and this is the case with LSOF.&lt;BR /&gt;&lt;BR /&gt;Thanks a million for all the help.&lt;BR /&gt;&lt;BR /&gt;jiin</description>
      <pubDate>Wed, 01 May 2002 17:22:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/testing-filesize-in-posix/m-p/2714727#M61459</guid>
      <dc:creator>Gerald Bush_2</dc:creator>
      <dc:date>2002-05-01T17:22:30Z</dc:date>
    </item>
  </channel>
</rss>

