<?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: Deleting files oler than 20 minutes in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355231#M684191</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; OldShool: I saw "move", but the above deletes.....&lt;BR /&gt;&lt;BR /&gt;Well, not mine, the code even says "move" :-))&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Mon, 16 Feb 2009 18:13:59 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-02-16T18:13:59Z</dc:date>
    <item>
      <title>Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355217#M684177</link>
      <description>Hi,&lt;BR /&gt;On my database server, archives are created in a file system very frequently and i move those archives to another file system so that this file system doesn't get full. My current job moves all archives to the other file system but some times it corrupts my archives because it also moves the archive currently being written and has not finished yet, so the solution in my mind is to move only archive files older than, let say 15 minutes so i will be sure that only finished archives are being moved to the other file system. Can anyone tell me how to edit my current script to accomplish this. Please see my script.&lt;BR /&gt;##########################################&lt;BR /&gt;date&lt;BR /&gt;for fstr in `find /odsdata1/archive/ods_* -type f -print`&lt;BR /&gt;do&lt;BR /&gt;  echo "Moving $fstr"&lt;BR /&gt;  mv $fstr /odsarchive2/backup/ods/archive/&lt;BR /&gt;done&lt;BR /&gt;date&lt;BR /&gt;echo "End of transfer"&lt;BR /&gt;######################################&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Salman</description>
      <pubDate>Tue, 10 Feb 2009 05:36:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355217#M684177</guid>
      <dc:creator>Salman Ahmed Qureshi</dc:creator>
      <dc:date>2009-02-10T05:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355218#M684178</link>
      <description>find files older than 1 hr&lt;BR /&gt;&lt;BR /&gt;# perl -MFile::Find -le 'find(sub{print $File::Find::name if -f $_ &amp;amp;&amp;amp; -M _ &amp;lt;= 1/24},@ARGV)' /path</description>
      <pubDate>Tue, 10 Feb 2009 06:00:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355218#M684178</guid>
      <dc:creator>Jeeshan</dc:creator>
      <dc:date>2009-02-10T06:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files older than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355219#M684179</link>
      <description>&lt;P&gt;You'll need to create a reference file with touch for 20 minutes ago. (Or use gnu find, -mmin +20.)&lt;BR /&gt;&lt;BR /&gt;The problem with 20 minutes ago is that you need to do date arithmetic on touch. If now is 16:00, then the reference file would be:&lt;BR /&gt;touch 02091540 ref_file&lt;BR /&gt;&lt;BR /&gt;You can also solve the reference file issue by creating it manually the first time then just use your sleep or cron to remember 20 minutes ago:&lt;BR /&gt;touch ref_file_new # for next time&lt;BR /&gt;for fstr in $(find /odsdata1/archive/ods_* -type f ! -newer ref_file); do&lt;BR /&gt;done&lt;BR /&gt;mv ref_file_new ref_file&lt;BR /&gt;sleep $(( 20 * 60 ))&lt;BR /&gt;&lt;BR /&gt;I suppose you could put the touch at the bottom if the find and mv doesn't take too long.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2011 11:13:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355219#M684179</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-04T11:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355220#M684180</link>
      <description>Hi Dennis,&lt;BR /&gt;Thanks for your reply. I would be rather interested in, "find -mmin" command. Can you please edit my script to add this portion. If you think that i can't achieve 20 mins, you can make it 1 hour.&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;Salman</description>
      <pubDate>Tue, 10 Feb 2009 06:18:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355220#M684180</guid>
      <dc:creator>Salman Ahmed Qureshi</dc:creator>
      <dc:date>2009-02-10T06:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355221#M684181</link>
      <description>Shalom Salman,&lt;BR /&gt;&lt;BR /&gt;Example script:&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=131801" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=131801&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;How to overcome issues that may come up in such a script:&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1227620" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1227620&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 10 Feb 2009 08:40:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355221#M684181</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-02-10T08:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files older than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355222#M684182</link>
      <description>&lt;P&gt;&amp;gt;"find -mmin" command. Can you please edit my script to add this portion?&lt;BR /&gt;&lt;BR /&gt;Unless you install GNU find, you can't. HP-UX's find only has the standard day granularity with -mtime. If you don't want to use GNU, you will have to use a reference file or use ahsan's perl solution.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;you can make it 1 hour.&lt;BR /&gt;&lt;BR /&gt;That is still 1/24 too small. :-)&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2011 11:13:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355222#M684182</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-04T11:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355223#M684183</link>
      <description>Hi Salman:&lt;BR /&gt;&lt;BR /&gt;To find your candidates, use Perl like this (sorry Ahsan, you can't just copy and paste previous solutions):&lt;BR /&gt;&lt;BR /&gt;# perl -MFile::Find -le '@ARGV=(".") unless @ARGV;find(sub{print $File::Find::name if -f $_ &amp;amp;&amp;amp; -M _ &amp;gt;= 1/96},@ARGV)' /path&lt;BR /&gt;&lt;BR /&gt;You can pass multiple /path arguments if you like.  RUnning without any argument ('/path') infers the current directory.&lt;BR /&gt;&lt;BR /&gt;The "1/96" is "1/96" of one day or one 15-miunute period of age.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Feb 2009 12:45:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355223#M684183</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-02-10T12:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355224#M684184</link>
      <description>&lt;!--!*#--&gt;Hi (atain) Salman:&lt;BR /&gt;&lt;BR /&gt;Actually, it is just as easy to do everything in one Perl script:&lt;BR /&gt;&lt;BR /&gt;# cat ./mymover&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;use File::Find;&lt;BR /&gt;use File::Copy;&lt;BR /&gt;my $dstdir='/odsarchive2/backup/ods/archive';&lt;BR /&gt;@ARGV = (".") unless @ARGV;&lt;BR /&gt;print STDERR "Begin @ ", scalar localtime, "\n";&lt;BR /&gt;find(&lt;BR /&gt;    sub {&lt;BR /&gt;        if ( -f $_ &amp;amp;&amp;amp; -M _ &amp;gt;= 1 / 96 ) {&lt;BR /&gt;            print STDERR "Moving '$_'\n";&lt;BR /&gt;            move( $File::Find::name, $dstdir ) or die "$!\n";&lt;BR /&gt;        }&lt;BR /&gt;    },&lt;BR /&gt;    @ARGV&lt;BR /&gt;);&lt;BR /&gt;print STDERR "Ended @ ", scalar localtime, "\n";&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;...Again, pass the source directory name or "." or nothing at all to denote the current working directory for the source path.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 10 Feb 2009 13:22:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355224#M684184</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-02-10T13:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files older than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355225#M684185</link>
      <description>&lt;P&gt;&amp;gt;JRF: The "1/96" is one 15-minute period&lt;BR /&gt;&lt;BR /&gt;You might want to use an expression so you don't have to explain it:&lt;BR /&gt;15 / (24 * 60)&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2011 11:14:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355225#M684185</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-04T11:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355226#M684186</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: You might want to use an expression so you don't have to explain it:&lt;BR /&gt;15 / (24 * 60)&lt;BR /&gt;&lt;BR /&gt;Yes, I agree, in this case that would be good.  So change:&lt;BR /&gt;&lt;BR /&gt;if ( -f $_ &amp;amp;&amp;amp; -M _ &amp;gt;= 1 / 96 ) {&lt;BR /&gt;&lt;BR /&gt;...to:&lt;BR /&gt;&lt;BR /&gt;if ( -f $_ &amp;amp;&amp;amp; -M _ &amp;gt;= ( 15 / ( 24 * 60 ) ) ) {&lt;BR /&gt;&lt;BR /&gt;...which makes the 15-minute interval much clearer and allows leveraging further:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;my $age=15&lt;BR /&gt;@ARGV = (".") unless @ARGV;&lt;BR /&gt;...&lt;BR /&gt;if ( -f $_ &amp;amp;&amp;amp; -M _ &amp;gt;= ( $age / ( 24 * 60 ) ) ) {&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Feb 2009 13:56:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355226#M684186</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-02-10T13:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355227#M684187</link>
      <description>Hi Salman,&lt;BR /&gt;all the above solution are fine for your problem, but you have to be sure tht the log file you are trying to move is not really in use by the database.&lt;BR /&gt;I suggest you to include in your script some Oracle command to shiwtch the log file in use (in sorry but now I don't rememeber those). IN this way you are sure that file older than 'x' min is really not in use.&lt;BR /&gt;Just my .02$.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Wed, 11 Feb 2009 06:30:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355227#M684187</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2009-02-11T06:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355228#M684188</link>
      <description>Hy, &lt;BR /&gt;&lt;BR /&gt;just wanted to leave you the zsh line for what you need:&lt;BR /&gt;&lt;BR /&gt;ls -ltr **/*(.mm+15)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Feb 2009 07:26:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355228#M684188</guid>
      <dc:creator>likid0</dc:creator>
      <dc:date>2009-02-11T07:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355229#M684189</link>
      <description>Ops sorry you actually wanted to delete them:&lt;BR /&gt;&lt;BR /&gt;If files, dirs and subdirs then:&lt;BR /&gt;rm -Rf **/*(.mm+15)&lt;BR /&gt;If only files:&lt;BR /&gt;rm -f *(.mm+15)</description>
      <pubDate>Wed, 11 Feb 2009 07:27:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355229#M684189</guid>
      <dc:creator>likid0</dc:creator>
      <dc:date>2009-02-11T07:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355230#M684190</link>
      <description>I saw "move", but the above deletes.....</description>
      <pubDate>Mon, 16 Feb 2009 17:57:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355230#M684190</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-02-16T17:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355231#M684191</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; OldShool: I saw "move", but the above deletes.....&lt;BR /&gt;&lt;BR /&gt;Well, not mine, the code even says "move" :-))&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Feb 2009 18:13:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355231#M684191</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-02-16T18:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting files oler than 20 minutes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355232#M684192</link>
      <description>seems to be that fuser might suffice to check if one of the files you want to move is open, rather than assuming that at some fixed point in time that its done.  &lt;BR /&gt;&lt;BR /&gt;or, as one of the other posters noted, force oracle to switch archives.  in such a case, build the list first, switch the file, then process everything in the list</description>
      <pubDate>Mon, 16 Feb 2009 18:49:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-files-oler-than-20-minutes/m-p/4355232#M684192</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-02-16T18:49:36Z</dc:date>
    </item>
  </channel>
</rss>

