<?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: Scripting help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311103#M185621</link>
    <description>one way is to check the file size and then check it again after a bit of time, if the size hasn't changed then you could assume the transfer is complete.&lt;BR /&gt;&lt;BR /&gt;second way is to send a second file after the first one.  if the second file is there the first one is finished.</description>
    <pubDate>Mon, 21 Jun 2004 14:12:40 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2004-06-21T14:12:40Z</dc:date>
    <item>
      <title>Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311101#M185619</link>
      <description>My weak scripting abilties fail me.  I need to know when a file that is being created by an application is finished being written to.  My current script finds the file since it exists, but because it's still being written to the file it ftp's to another location is a truncated unfinished version.&lt;BR /&gt;&lt;BR /&gt;My thought was since I find the file by it's name, maybe I could somehow check it's creation date and time to make sure it's at least five minutes old.  That way I would know the process is finished writing to it .(since the time and date are constantly updated as the application writes to the file)&lt;BR /&gt;&lt;BR /&gt;The file finishes at various times each day, bit it needs to be ftp'd to it's destination as soon as it's finished.&lt;BR /&gt;&lt;BR /&gt;I have a cron job at seven each morning that starts looking for the file and if it's ready it needs to be ftp'd.  So if the script can check it's time and then maybe do an "at" command to check again in five minutes if the file isn't at least five minutes old (and therefore finished).&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Jun 2004 14:04:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311101#M185619</guid>
      <dc:creator>Terrence</dc:creator>
      <dc:date>2004-06-21T14:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311102#M185620</link>
      <description>You can use diff...capture the file to a new name then compare&lt;BR /&gt;&lt;BR /&gt;diff orig.file lastest.file&lt;BR /&gt;&lt;BR /&gt;Then continue to compare the file until the output is null then you can ftp it...&lt;BR /&gt;&lt;BR /&gt;Should be a loop to check every N interval maybe a sleep command.</description>
      <pubDate>Mon, 21 Jun 2004 14:10:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311102#M185620</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2004-06-21T14:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311103#M185621</link>
      <description>one way is to check the file size and then check it again after a bit of time, if the size hasn't changed then you could assume the transfer is complete.&lt;BR /&gt;&lt;BR /&gt;second way is to send a second file after the first one.  if the second file is there the first one is finished.</description>
      <pubDate>Mon, 21 Jun 2004 14:12:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311103#M185621</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-06-21T14:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311104#M185622</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You could use the 'fuser' command to see if a process has the file open, and start the ftp when it doesn't.  The only trick is that you have to be root to run 'fuser'.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Jun 2004 14:13:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311104#M185622</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2004-06-21T14:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311105#M185623</link>
      <description>I would check if file is in use or not.&lt;BR /&gt;&lt;BR /&gt;Get lsof tool and check if it is being used by any process? If not ftp it.&lt;BR /&gt;&lt;BR /&gt;You can also use fuser for this.&lt;BR /&gt;fuser -u file_name&lt;BR /&gt;&lt;BR /&gt;Man fuser. Get laos tool from HP porting center.&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Mon, 21 Jun 2004 14:13:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311105#M185623</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-06-21T14:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311106#M185624</link>
      <description>This is one of those things that Perl's stat() function is just made to handle.&lt;BR /&gt;&lt;BR /&gt;See the attached fileage.pl script and invoke it as fileage.pl -u for full usage.&lt;BR /&gt;&lt;BR /&gt;For your specific question:&lt;BR /&gt;&lt;BR /&gt;TESTFILE=myfile&lt;BR /&gt;fileage.pl -s 300 ${TESTFILE}&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "File ${TESTFILE} has not been modified in the last 300 seconds."&lt;BR /&gt;else&lt;BR /&gt;  echo "File ${TESTFILE} has been modified within the last 300 seconds."&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Jun 2004 14:15:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311106#M185624</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-06-21T14:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311107#M185625</link>
      <description>This isn't exactly what you asked for, but perhaps you didn't ask for precisely what you need? ... How about making the application that writes the file, since presumably it will know when it is done, do the ftp itself, or activate the other process, script, program or whatever to do the ftp...?</description>
      <pubDate>Mon, 21 Jun 2004 16:42:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3311107#M185625</guid>
      <dc:creator>John Kittel</dc:creator>
      <dc:date>2004-06-21T16:42:18Z</dc:date>
    </item>
  </channel>
</rss>

