<?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: About copy file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277563#M179832</link>
    <description>thx replies,  it can't put to the same batch job because the permission reason .</description>
    <pubDate>Sun, 16 May 2004 22:39:54 GMT</pubDate>
    <dc:creator>peterchu</dc:creator>
    <dc:date>2004-05-16T22:39:54Z</dc:date>
    <item>
      <title>About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277560#M179829</link>
      <description>We have two batch jobs , one batch job is rcp a file from remote site to /tmp  , and another batch job is to move this file to other directory , but I found that sometimes the second batch job (move file) is processing while it is still copying from remote site , therefore , the file is not complete , could suggest is the best way to solve it ? thx.</description>
      <pubDate>Sun, 16 May 2004 22:23:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277560#M179829</guid>
      <dc:creator>peterchu</dc:creator>
      <dc:date>2004-05-16T22:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277561#M179830</link>
      <description>The best way would be to use something like fuser or lsof to make sure there are not any processes with the file open.&lt;BR /&gt;&lt;BR /&gt;In your script do an 'fuser -u filename' and if anything is returned then sleep for a period of time and try again.</description>
      <pubDate>Sun, 16 May 2004 22:32:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277561#M179830</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2004-05-16T22:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277562#M179831</link>
      <description>hi,&lt;BR /&gt;how about putting both the commands in the same job???&lt;BR /&gt;&lt;BR /&gt;with best wishes&lt;BR /&gt;Naveej</description>
      <pubDate>Sun, 16 May 2004 22:35:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277562#M179831</guid>
      <dc:creator>Naveej.K.A</dc:creator>
      <dc:date>2004-05-16T22:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277563#M179832</link>
      <description>thx replies,  it can't put to the same batch job because the permission reason .</description>
      <pubDate>Sun, 16 May 2004 22:39:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277563#M179832</guid>
      <dc:creator>peterchu</dc:creator>
      <dc:date>2004-05-16T22:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277564#M179833</link>
      <description>start second job later&lt;BR /&gt;&lt;BR /&gt;check for the file size in second job, if the file size hasn't increased in last 20 seconds, it is probably done being copied&lt;BR /&gt;&lt;BR /&gt;have first job creates a file once the rcp is finished saying it is done, second job doesn't copy file till rcp done file exists.</description>
      <pubDate>Sun, 16 May 2004 22:41:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277564#M179833</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-05-16T22:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277565#M179834</link>
      <description>thx suggestion , do you have the sample script for my reference .&lt;BR /&gt;&lt;BR /&gt;thx</description>
      <pubDate>Sun, 16 May 2004 23:10:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277565#M179834</guid>
      <dc:creator>peterchu</dc:creator>
      <dc:date>2004-05-16T23:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277566#M179835</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;simple resolution. you make lock file.&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;---rcp.sh---&lt;BR /&gt;touch /tmp/during_rcp&lt;BR /&gt;rcp foo bar&lt;BR /&gt;rm /tmp/during_rcp&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;---mv.sh---&lt;BR /&gt;while [ -f /tmp/during_rcp ]&lt;BR /&gt;do&lt;BR /&gt;sleep 300&lt;BR /&gt;done&lt;BR /&gt;mv bar baz&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;or:&lt;BR /&gt;use lockf(2) ( see man page lockf ).&lt;BR /&gt;or:&lt;BR /&gt;chmod -r ...&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Sun, 16 May 2004 23:11:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277566#M179835</guid>
      <dc:creator>Kiyoshi Miyake</dc:creator>
      <dc:date>2004-05-16T23:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277567#M179836</link>
      <description>In my organisation we call it a special resource .. but in a way it will help you in this case as well .. this is about creating a common lock / special resource which enable the script to do it's task.&lt;BR /&gt;&lt;BR /&gt;Something like script1 and script2 starts with ..&lt;BR /&gt;************&lt;BR /&gt;while [ -f /var/tmp/SPR_REMOTE_CP ]&lt;BR /&gt;do&lt;BR /&gt;echo Lock file present &amp;gt;&amp;gt; $LOGFILE&lt;BR /&gt;sleep 60&lt;BR /&gt;done&lt;BR /&gt;touch /var/tmp/SPR_REMOTE_CP #Taken exclusive access&lt;BR /&gt;&lt;BR /&gt;rcp or mv bla bla ........   #Do the task&lt;BR /&gt;&lt;BR /&gt;rm /var/tmp/SPR_REMOTE # Removes the lock&lt;BR /&gt;&lt;BR /&gt;Regds,&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Sun, 16 May 2004 23:42:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277567#M179836</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-05-16T23:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277568#M179837</link>
      <description>Peterchu,&lt;BR /&gt;What i think is before using mv command check for the existing of the file first and if it exists then only try moving it. See if this works for you.&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do &lt;BR /&gt;if [ -f /tmp/filename ]&lt;BR /&gt;then &lt;BR /&gt;   mv /tmp/filename /anotherdir&lt;BR /&gt;   exit&lt;BR /&gt;else &lt;BR /&gt;   sleep 10&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;  &lt;BR /&gt;</description>
      <pubDate>Sun, 16 May 2004 23:48:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277568#M179837</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-05-16T23:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277569#M179838</link>
      <description>Little clearance:&lt;BR /&gt;I have used "true" and "exit" that may not be suitable in your script so modify accordingly to your requirement.&lt;BR /&gt;This is just an example.&lt;BR /&gt;</description>
      <pubDate>Sun, 16 May 2004 23:53:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277569#M179838</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-05-16T23:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277570#M179839</link>
      <description>thx all replies , I want to use lock to fix it , could suggest how to write a script to use it ? thx.</description>
      <pubDate>Mon, 17 May 2004 05:38:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277570#M179839</guid>
      <dc:creator>peterchu</dc:creator>
      <dc:date>2004-05-17T05:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: About copy file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277571#M179840</link>
      <description>Using a lock file to coordinate between the 2 cron jobs is a good idea. We have used them in the past. One caution. Sometimes one of the cron jobs will die and leave the lock file in place. You should have some mechanism to check for stale lock files and remove them.</description>
      <pubDate>Tue, 18 May 2004 08:12:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/about-copy-file/m-p/3277571#M179840</guid>
      <dc:creator>Michael D'Aulerio</dc:creator>
      <dc:date>2004-05-18T08:12:48Z</dc:date>
    </item>
  </channel>
</rss>

