<?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: Check time in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732106#M65716</link>
    <description>This is an extract from a perl program I use for the same sort of thing;&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt; &lt;BR /&gt;$now = time;&lt;BR /&gt;&lt;BR /&gt;foreach $filename (@ARGV) {&lt;BR /&gt; &lt;BR /&gt;($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $filename;&lt;BR /&gt; &lt;BR /&gt;   $age = ($now - $mtime) / 60 ;&lt;BR /&gt; &lt;BR /&gt;   if ( $age &amp;gt; 20 ) {&lt;BR /&gt;   printf ("WARNING: %s is %d minutes old\n", $filename, $age);&lt;BR /&gt;    }&lt;BR /&gt; &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;All you do is run the script, with the file(s) you want the age of as parameters&lt;BR /&gt;&lt;BR /&gt;eg:  how_old.sh &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;Where &lt;FILENAME&gt; is the name of the file that you've already obtained.&lt;/FILENAME&gt;&lt;/FILENAME&gt;</description>
    <pubDate>Mon, 27 May 2002 14:11:29 GMT</pubDate>
    <dc:creator>Chris Wilshaw</dc:creator>
    <dc:date>2002-05-27T14:11:29Z</dc:date>
    <item>
      <title>Check time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732101#M65711</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I???ve a problem,&lt;BR /&gt;With this command:  ls ???ltr events/e*/* |awk ???NR==1 [print $8]???&lt;BR /&gt;&lt;BR /&gt;I find the oldest file in a directory.&lt;BR /&gt;&lt;BR /&gt;This file is removed from time to time,&lt;BR /&gt;And I need to know if It is becoming  is older than 20 minutes&lt;BR /&gt;I can compare time stamp with current date(date command)&lt;BR /&gt;&lt;BR /&gt;But I don???t know thow to create script to understand&lt;BR /&gt;If this file is older than 20 minutes.&lt;BR /&gt;&lt;BR /&gt;Regards, Angelo&lt;BR /&gt;</description>
      <pubDate>Mon, 27 May 2002 12:31:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732101#M65711</guid>
      <dc:creator>Trenta Angelo</dc:creator>
      <dc:date>2002-05-27T12:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Check time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732102#M65712</link>
      <description>Hi Trenta,&lt;BR /&gt;&lt;BR /&gt;all you need is a reference file which you need to compare with your found file.&lt;BR /&gt;&lt;BR /&gt;man touch&lt;BR /&gt;&lt;BR /&gt;touch reference_time filename&lt;BR /&gt;&lt;BR /&gt;With this command you make a file with a reference time. Use this file with find command to check the age.&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Mon, 27 May 2002 12:52:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732102#M65712</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-05-27T12:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Check time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732103#M65713</link>
      <description>See this thread:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1ac191ccb36bd611abdb0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1ac191ccb36bd611abdb0090277a778c,00.html&lt;/A&gt;</description>
      <pubDate>Mon, 27 May 2002 13:16:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732103#M65713</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2002-05-27T13:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Check time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732104#M65714</link>
      <description>Hi Angelo,&lt;BR /&gt;&lt;BR /&gt;Well, you can get the similar date from from date '+%H:%m'. Try splitting the hour and minute and using expr to figure out if the difference is less than 20.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;James</description>
      <pubDate>Mon, 27 May 2002 13:20:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732104#M65714</guid>
      <dc:creator>James Beamish-White</dc:creator>
      <dc:date>2002-05-27T13:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Check time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732105#M65715</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Using your command:-&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;# File Watcher&lt;BR /&gt;# Log file /tmp/fwatcher&lt;BR /&gt;fdate=`ls ???ltr events/e*/* |awk ???NR==1 [print $8]???`&lt;BR /&gt;date &amp;gt;&amp;gt;/tmp/fwatcher&lt;BR /&gt;echo $fdate &amp;gt;&amp;gt;/tmp/fwatcher&lt;BR /&gt;mailx -s "File Watcher log" (Your email address) &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cron it to run when you require and monitor the log file.&lt;BR /&gt;&lt;BR /&gt;Quick, easy and mailed to your desktop.&lt;BR /&gt;&lt;BR /&gt;Paula&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 27 May 2002 13:20:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732105#M65715</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-05-27T13:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Check time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732106#M65716</link>
      <description>This is an extract from a perl program I use for the same sort of thing;&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt; &lt;BR /&gt;$now = time;&lt;BR /&gt;&lt;BR /&gt;foreach $filename (@ARGV) {&lt;BR /&gt; &lt;BR /&gt;($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $filename;&lt;BR /&gt; &lt;BR /&gt;   $age = ($now - $mtime) / 60 ;&lt;BR /&gt; &lt;BR /&gt;   if ( $age &amp;gt; 20 ) {&lt;BR /&gt;   printf ("WARNING: %s is %d minutes old\n", $filename, $age);&lt;BR /&gt;    }&lt;BR /&gt; &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;All you do is run the script, with the file(s) you want the age of as parameters&lt;BR /&gt;&lt;BR /&gt;eg:  how_old.sh &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;Where &lt;FILENAME&gt; is the name of the file that you've already obtained.&lt;/FILENAME&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 27 May 2002 14:11:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732106#M65716</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2002-05-27T14:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Check time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732107#M65717</link>
      <description>Chris, please check if you are /realy/ using /usr/contib/bin/perl, which is likely to be a *very* outdated perl version 4.036&lt;BR /&gt;&lt;BR /&gt;Check if you've also got /opt/perl/bin/perl, which should be version 5.6.1&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;#!/opt/perl/bin/perl -w&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;my $now = time;&lt;BR /&gt;&lt;BR /&gt;foreach my $filename (@ARGV) {&lt;BR /&gt;my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $filename;&lt;BR /&gt;&lt;BR /&gt;$age = ($now - $mtime) / 60 ;&lt;BR /&gt;&lt;BR /&gt;if ($age &amp;gt; 20) {&lt;BR /&gt;print "WARNING: $filename is $age minutes old\n";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;how_old.sh would be a very misleading name for a perl script. Please us .pl as extension, so others will still know what to expect.&lt;BR /&gt;&lt;BR /&gt;eg: how_old.pl &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;There have been many more threads that look like this one, and the perl solution could be made much more flexible if you use the standard module File::Find.&lt;BR /&gt;&lt;BR /&gt;The age of a file can also (and much easier) be determined with the -M and -A operators (age of the file since the start of the script measured in (fractions of) days&lt;BR /&gt;&lt;BR /&gt;-M $file &amp;gt; 4 and die;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 27 May 2002 15:29:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-time/m-p/2732107#M65717</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-05-27T15:29:22Z</dc:date>
    </item>
  </channel>
</rss>

