<?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: More Time in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713350#M251464</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can use command &lt;BR /&gt;touch -t time file_stamp&lt;BR /&gt;time can be set up somehow as now -5 minutes&lt;BR /&gt;After you run&lt;BR /&gt;find dirname -newer file_stamp -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;HTH</description>
    <pubDate>Thu, 19 Jan 2006 14:44:08 GMT</pubDate>
    <dc:creator>Victor Fridyev</dc:creator>
    <dc:date>2006-01-19T14:44:08Z</dc:date>
    <item>
      <title>More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713347#M251461</link>
      <description>I'm trying to figure out if there is a way to write a ksh script that will find and delete all directories and their sub-files that are more than 5 minutes old. Anyone have an idea how/if I can use mtime or ctime or something like that to make something that works? Basically a clean-up type of ksh script to put into crontab to run every 5 min.</description>
      <pubDate>Thu, 19 Jan 2006 14:38:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713347#M251461</guid>
      <dc:creator>Rob Blake</dc:creator>
      <dc:date>2006-01-19T14:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713348#M251462</link>
      <description>Hi Rob, ctime and mtime uses multiples of 24 hours.</description>
      <pubDate>Thu, 19 Jan 2006 14:42:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713348#M251462</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-19T14:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713349#M251463</link>
      <description>Rob,&lt;BR /&gt;&lt;BR /&gt;You need to look at a combination of the touch and find commands.  Use touch to create a file with a time stamp of 5 minutes prior.  Then use find to detect and remove any files older than your reference file.&lt;BR /&gt;&lt;BR /&gt;touch -t [[CC]YY]MMDDhhmm[.SS] ref_file&lt;BR /&gt;find /start_dir -type f ! -newer ref_file -exec rm {} \; &lt;BR /&gt; -or-&lt;BR /&gt;find /start_dir -type f ! -newer ref_file | xargs rm&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 19 Jan 2006 14:43:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713349#M251463</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2006-01-19T14:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713350#M251464</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can use command &lt;BR /&gt;touch -t time file_stamp&lt;BR /&gt;time can be set up somehow as now -5 minutes&lt;BR /&gt;After you run&lt;BR /&gt;find dirname -newer file_stamp -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Thu, 19 Jan 2006 14:44:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713350#M251464</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2006-01-19T14:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713351#M251465</link>
      <description>Hi Rob:&lt;BR /&gt;&lt;BR /&gt;First compute a timestamp that is 5-minutes less than the current time:&lt;BR /&gt;&lt;BR /&gt;Use the following perl script called "/tmp/time":&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;$t=((time)-300);&lt;BR /&gt;($mon,$day,$hr,$min)=(localtime($t))[4,3,2,1];&lt;BR /&gt; $mon++;&lt;BR /&gt;printf("%02d%02d%02d%02d\n",$mon,$day,$hr,$min)&lt;BR /&gt;&lt;BR /&gt;In your cron task do:&lt;BR /&gt;&lt;BR /&gt;# TS=`/tmp/time`&lt;BR /&gt;&lt;BR /&gt;# touch -amt ${TS} /tmp/myref&lt;BR /&gt;# find /path -xdev -type f ! -newer /tmp/myref | xargs rm&lt;BR /&gt;# find /path -xdev -type d -newer /tmp/myref | xargs rmdir&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;This does a pass for files first, and then secondarily for empty directories.  Since deletion of the files in a subdirectory will update the directory's timestampe ('mtime') I chose the positive form of '-newer' whereas the negated '-newer' argument was applied to the files.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 19 Jan 2006 15:12:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713351#M251465</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-19T15:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713352#M251466</link>
      <description>Hi,&lt;BR /&gt;I use this command to remove teh core file:&lt;BR /&gt;It founds the core file in the current modified from 24 hours ago to now&lt;BR /&gt;&lt;BR /&gt;find . -name "core" -mtime -1 -type f -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;I scheduled it in crontab to run every 5 minutes and teh result is that I remove teh core file every 5 minutes.&lt;BR /&gt;HTH,&lt;BR /&gt;Art&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jan 2006 04:42:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713352#M251466</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-01-20T04:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713353#M251467</link>
      <description>Or (proving yet again that there is more than one way to skin a cat in shell) ...&lt;BR /&gt;&lt;BR /&gt;Your cron job (which runs every 5 minutes) should look for a reference file in a known location. &lt;BR /&gt;&lt;BR /&gt;If the file is absent, then create it (its timestamp will be set to now) do nething else this time.&lt;BR /&gt;&lt;BR /&gt;If the file is present, then it was created by your cron job 5 minutes ago, so any file older than it can be removed. Then touch your reference file (its timestamp will be set to now) so that the next time the cron job runs it will be 5 minutes old.&lt;BR /&gt;&lt;BR /&gt;The advtange of doing it this way is you can change how old the files need to be before deleting them by changing the cron job frequency rather than having to edit the script each time.&lt;BR /&gt;&lt;BR /&gt;Just my Â£0.02 worth.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jan 2006 05:33:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713353#M251467</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2006-01-20T05:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713354#M251468</link>
      <description>JRF suggests:&lt;BR /&gt;&lt;BR /&gt;# find /path -xdev -type f ! -newer /tmp/myref | xargs rm&lt;BR /&gt;# find /path -xdev -type d -newer /tmp/myref | xargs rmdir&lt;BR /&gt;&lt;BR /&gt;James, just looking at it, the above seems to delete all files that are younger than the reference file /tmp/myref rather than older.&lt;BR /&gt;&lt;BR /&gt;Am I reading this wrong? What can I put on the end to replace the xargs rm and xargs rmdir that will show me which files are fixing to be deleted before I actually try and run a test of this.&lt;BR /&gt;&lt;BR /&gt;So far, the script looks like this ...&lt;BR /&gt;&lt;BR /&gt;rm /tmp/myref&lt;BR /&gt;START=${HOME}&lt;BR /&gt;echo ${START}&lt;BR /&gt;TARGET=${HOME}/targetdir&lt;BR /&gt;echo ${TARGET}&lt;BR /&gt;cd ${TARGET}&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# Run temp_time to get the date time less 5 minutes&lt;BR /&gt;#####&lt;BR /&gt;TS=`${PS_HOME}/temp_time`&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# Touch to create a reference file in tmp directory&lt;BR /&gt;#####&lt;BR /&gt;touch -amt ${TS} /tmp/myref&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# find all files and directories in the target directory that are older&lt;BR /&gt;# than the reference file.&lt;BR /&gt;#####&lt;BR /&gt;find ${TARGET} -xdev -type f ! -newer /tmp/myref | xargs rm&lt;BR /&gt;find ${TARGET} -xdev -type d -newer /tmp/myref | xargs rmdir&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# Exit script&lt;BR /&gt;#####&lt;BR /&gt;cd ${START}&lt;BR /&gt;exit 0&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jan 2006 08:55:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713354#M251468</guid>
      <dc:creator>Rob Blake</dc:creator>
      <dc:date>2006-01-20T08:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713355#M251469</link>
      <description>The "! -newer" syntax says not newer, i.e. older.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 20 Jan 2006 08:57:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713355#M251469</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2006-01-20T08:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713356#M251470</link>
      <description>You do realise that when you delete a file from a directory, you update the directory (and hence its access time) as well?</description>
      <pubDate>Fri, 20 Jan 2006 08:59:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713356#M251470</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2006-01-20T08:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713357#M251471</link>
      <description>Sorry, I missed your second question.&lt;BR /&gt;&lt;BR /&gt;To test, replace the "xargs rm" with "xargs ll".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 20 Jan 2006 09:07:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713357#M251471</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2006-01-20T09:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713358#M251472</link>
      <description>Which won't change the access time, so isn't a perfect test.</description>
      <pubDate>Fri, 20 Jan 2006 09:09:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713358#M251472</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2006-01-20T09:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713359#M251473</link>
      <description>Hi (again) Rob:&lt;BR /&gt;&lt;BR /&gt;Yes, Pete is correct, the "!" symbol is negation, so "! -newer" is "not newer" or hence, older.&lt;BR /&gt;&lt;BR /&gt;Yes, of course, deleting a file from a directory updates the directory's *modification* ('mtime').  Traversing (reading) a directory with 'find' updates the directory's lastaccess time ('atime').  &lt;BR /&gt;&lt;BR /&gt;By default the '-newer' argument to 'find' operates on the structures 'mtime'.&lt;BR /&gt;&lt;BR /&gt;The idea I had was to make a pass to delete *files* matching your criteria and then in a second pass delete empty directories.  The 'rmdir' will fail if the directory isn't empty which is what you want if files have been *added* anyway.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 20 Jan 2006 09:38:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713359#M251473</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-20T09:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713360#M251474</link>
      <description>Hi Rob:&lt;BR /&gt;&lt;BR /&gt;I must chuckle.  Stephen's comment about there's more than one way to do anything is so appropriate!&lt;BR /&gt;&lt;BR /&gt;Computing a file's timestamp a few minutes ago is so easy that I focused on that approach rather than a continuous crontask that simply creates its reference point the first time and nothing more.&lt;BR /&gt;&lt;BR /&gt;Stephen deserves high marks here!&lt;BR /&gt;&lt;BR /&gt;In any event, to be perfectly correct at the turn of a year, I should offer:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;$t=((time)-300);&lt;BR /&gt;($year,$mon,$day,$hr,$min)=(localtime($t))[5,4,3,2,1];&lt;BR /&gt; $year+=1900;&lt;BR /&gt; $mon++;&lt;BR /&gt;printf("%04d%02d%02d%02d%02d\n",$year,$mon,$day,$hr,$min);&lt;BR /&gt;&lt;BR /&gt;Calling the above script whatever you want (e.g. $HOME/time5) you can abbreviate your shell's creation of a reference file to:&lt;BR /&gt;&lt;BR /&gt;# touch -amt `$HOME/time5` /tmp/myref&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 20 Jan 2006 09:53:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713360#M251474</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-20T09:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713361#M251475</link>
      <description>Hi (once more):&lt;BR /&gt;&lt;BR /&gt;I'm sorry, I just noticed your other question, "What can I put on the end to replace the xargs rm and xargs rmdir that will show me which files are fixing to be deleted before I actually try and run a test of this?"&lt;BR /&gt;&lt;BR /&gt;Simply write "...|xargs" without any other arguments.  'xargs' will substitute 'echo' in the absence of any argument.&lt;BR /&gt;&lt;BR /&gt;Another useful feature of 'xargs' is to add a '-t' option to cause a trace of what was done to be printed:&lt;BR /&gt;&lt;BR /&gt;... | xargs -t rm&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jan 2006 10:01:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713361#M251475</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-20T10:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713362#M251476</link>
      <description>Thanks for all the great help and ideas. So far the resulting two(2) scripts have been created and tested manually against our development environment:&lt;BR /&gt;&lt;BR /&gt;SCRIPT: temp_time&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;$t=((time)-300);&lt;BR /&gt;($mon,$day,$hr,$min)=(localtime($t))[4, 3, 2, 1];&lt;BR /&gt;$mon++;&lt;BR /&gt;printf("%02d%02d%02d%02d\n",$mon,$day,$hr,$min);&lt;BR /&gt;exit;&lt;BR /&gt;&lt;BR /&gt;SCRIPT: clear_up&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#####&lt;BR /&gt;# Remove old reference file&lt;BR /&gt;#####&lt;BR /&gt;rm /tmp/myref&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# Setup home and target directories&lt;BR /&gt;#####&lt;BR /&gt;START=${HOME}&lt;BR /&gt;TARGET=&lt;TARGET directory=""&gt;&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# Run temp_time to get the date time less 5 minutes&lt;BR /&gt;#####&lt;BR /&gt;TS=`${START}/temp_time`&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# Touch to create a reference file in temporary directory&lt;BR /&gt;#####&lt;BR /&gt;touch -amt ${TS} /tmp/myref&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# find and delete all files, directories, and&lt;BR /&gt;# sub-files older than the reference file.&lt;BR /&gt;#####&lt;BR /&gt;find ${TARGET} -xdev -type f ! -newer /tmp/myref | xargs rm&lt;BR /&gt;find ${TARGET} -xdev -type d -newer /tmp/myref | xargs rmdir&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;# Exit script&lt;BR /&gt;#####&lt;BR /&gt;cd ${START}&lt;BR /&gt;&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Will be copyng these to the pre-production environment to test maually and via crontab of clear_up script before moving to Production. Thanks to everyone for their input and assistance on this. Believe me - the UNT students will appreciate it.&lt;/TARGET&gt;</description>
      <pubDate>Fri, 20 Jan 2006 11:00:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713362#M251476</guid>
      <dc:creator>Rob Blake</dc:creator>
      <dc:date>2006-01-20T11:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713363#M251477</link>
      <description>Rob:&lt;BR /&gt;&lt;BR /&gt;I suggest you use the second perl script I posted which covers the change of the year.&lt;BR /&gt;&lt;BR /&gt;Glad to have been of help...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 20 Jan 2006 11:02:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713363#M251477</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-01-20T11:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: More Time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713364#M251478</link>
      <description>james - thanks for the advice. Changes made as suggested to temp_time.</description>
      <pubDate>Fri, 20 Jan 2006 12:19:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-time/m-p/3713364#M251478</guid>
      <dc:creator>Rob Blake</dc:creator>
      <dc:date>2006-01-20T12:19:29Z</dc:date>
    </item>
  </channel>
</rss>

