Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
google site



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-03-2009
Registered User
 

Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
find -mtime giving strage results in HP-UX

Hi,

I am using HP-UX B.11.23 U ia64

I am trying to retrieve files using -mtime option of find command

However I found that -mtime is not giving correct results

Following is the output of commands executed on 03-Dec-2009

It can be seen that -mtime +1 should have returned all files from "Dec 2" backwards
However it is listing files from "Nov 26" backwards

Similarly -mtime +1 should have returned all files from "Nov 26" backwards
instead the command is listing files "Nov 24" backwards

What could be the reason?

Does -mtime starts with last day of last month backwards in HP-UX?

Thanks and Regards,
Chetana

Quote:
oracle@dev1:/u01/data/DB01/archive1 $ls -ltr
total 15116040
-rw-r----- 1 oracle dba 209714176 Nov 20 13:49 DB01_0001_0000000235.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:10 DB01_0001_0000000236.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:29 DB01_0001_0000000237.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:47 DB01_0001_0000000238.arc
-rw-r----- 1 oracle dba 209714176 Nov 21 08:30 DB01_0001_0000000239.arc
-rw-r----- 1 oracle dba 209714176 Nov 23 21:34 DB01_0001_0000000240.arc
-rw-r----- 1 oracle dba 2048 Nov 24 07:48 DB01_0002_0000000001.arc
-rw-r----- 1 oracle dba 2048 Nov 24 08:41 DB01_0002_0000000002.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:23 DB01_0001_0000000041.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:55 DB01_0001_0000000042.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:56 DB01_0001_0000000043.arc
-rw-rw---- 1 oracle dba 160875520 Nov 30 11:10 DB01_0001_0000000056.arc
-rw-rw---- 1 oracle dba 6833152 Dec 1 18:36 DB01_0001_0000000001.arc
-rw-rw---- 1 oracle dba 880640 Dec 1 19:43 DB01_0001_0000000002.arc
-rw-rw---- 1 oracle dba 1668096 Dec 1 21:47 DB01_0001_0000000003.arc
-rw-rw---- 1 oracle dba 1844224 Dec 2 00:04 DB01_0001_0000000004.arc
-rw-rw---- 1 oracle dba 69372928 Dec 2 01:19 DB01_0001_0000000005.arc
-rw-rw---- 1 oracle dba 299008 Dec 2 01:41 DB01_0001_0000000006.arc
-rw-rw---- 1 oracle dba 85476352 Dec 2 19:05 DB01_0001_0000000026.arc
-rw-rw---- 1 oracle dba 209714176 Dec 3 08:56 DB01_0001_0000000027.arc
-rw-rw---- 1 oracle dba 209713152 Dec 3 09:03 DB01_0001_0000000028.arc
-rw-rw---- 1 oracle dba 209711104 Dec 3 09:09 DB01_0001_0000000029.arc

oracle@dev1:/u01/data/DB01/archive1 $find . -name "*.arc" -mtime +1 -exec ls -ltr {} \;

-rw-r----- 1 oracle dba 209714176 Nov 20 13:49 DB01_0001_0000000235.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:10 DB01_0001_0000000236.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:29 DB01_0001_0000000237.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:47 DB01_0001_0000000238.arc
-rw-r----- 1 oracle dba 209714176 Nov 21 08:30 DB01_0001_0000000239.arc
-rw-r----- 1 oracle dba 209714176 Nov 23 21:34 DB01_0001_0000000240.arc
-rw-r----- 1 oracle dba 2048 Nov 24 07:48 DB01_0002_0000000001.arc
-rw-r----- 1 oracle dba 2048 Nov 24 08:41 DB01_0002_0000000002.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:23 DB01_0001_0000000041.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:55 DB01_0001_0000000042.arc
-rw-rw---- 1 oracle dba 209714176 Nov 26 05:56 DB01_0001_0000000043.arc


oracle@dev1:/u01/data/DB01/archive1 $find . -name "*.arc" -mtime +7 -exec ls -ltr {} \;
-rw-r----- 1 oracle dba 2048 Nov 24 07:48 ./DB01_0002_0000000001.arc
-rw-r----- 1 oracle dba 2048 Nov 24 08:41 ./DB01_0002_0000000002.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 13:49 ./DB01_0001_0000000235.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:10 ./DB01_0001_0000000236.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:29 ./DB01_0001_0000000237.arc
-rw-r----- 1 oracle dba 209714176 Nov 20 14:47 ./DB01_0001_0000000238.arc
-rw-r----- 1 oracle dba 209714176 Nov 21 08:30 ./DB01_0001_0000000239.arc
-rw-r----- 1 oracle dba 209714176 Nov 23 21:34 ./DB01_0001_0000000240.arc

Last edited by Chetanaz; 12-03-2009 at 06:38 AM.. Reason: formatting
Sponsored Links
  #2  
Old 12-03-2009
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 6,777
Thanks: 2
Thanked 68 Times in 63 Posts
First off - mtime +1 finds files that are > 86400 seconds (1 days worth of seconds) older than RIGHT NOW, not 1 "day" older as us humans view the calendar.

So the results you get will depend upon
1. the actual mtime of the file
2. what time of day you run find relative to the filetime.

That said I don't see why you do not get files from Dec 1 and Nov 30. And no, to the best of my knowledge find on 11.23 is not broken, nor is it in need of a patch.

Are these files mounted on a remote machine - in another time zone or on a box with a time drift problem?? mtime uses epoch seconds as mtime stored in the directory file -- not what you see in the ls -l display.
  #3  
Old 12-03-2009
Registered User
 

Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Many Thanks Jim!

Those files were on SAN!!

Now tested on local drive, but still results are strange as can be seen below :

Quote:
oracle@dev:/u05/oradata/AIG1/data$bdf -l
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol4 15368192 6421424 8876952 42% /
/dev/vg00/lvol1 1048576 221176 821016 21% /stand
/dev/vg00/lvol7 32768000 7530928 25040744 23% /var
/dev/bkpups1/AIG
1073545216 90979687 921155630 9% /u05/oradata/AIG
/dev/bkpups1/AIG1
1073610752 713496801 337606879 68% /u05/oradata/AIG1

oracle@dev:/u05/oradata/AIG1/data$
oracle@dev:/u05/oradata/AIG1/data$ls -ltr
total 4763596
-rw-r----- 1 oracle dba 52429824 Dec 1 14:23 redo1_2a.dbf
-rw-r----- 1 oracle dba 52429824 Dec 1 14:23 redo1_2b.dbf
-rw-r----- 1 oracle dba 52429824 Dec 1 14:25 redo1_3b.dbf
-rw-r----- 1 oracle dba 52429824 Dec 1 14:25 redo1_3a.dbf
-rw-r----- 1 oracle dba 524296192 Dec 1 14:25 amig_tbs.dbf
-rw-r----- 1 oracle dba 524296192 Dec 1 14:35 undo_01.dbf
-rw-r----- 1 oracle dba 1073750016 Dec 1 14:35 system.dbf
-rw-r----- 1 oracle dba 52429824 Dec 3 13:09 redo1_1a.dbf
-rw-r----- 1 oracle dba 52429824 Dec 3 13:09 redo1_1b.dbf
-rw-r----- 1 oracle dba 1007616 Dec 3 13:12 control_02.dbf
-rw-r----- 1 oracle dba 1007616 Dec 3 13:12 control_01.dbf
oracle@dev:/u05/oradata/AIG1/data$

oracle@dev:/u05/oradata/AIG1/data$find . -mtime +1
oracle@dev:/u05/oradata/AIG1/data$

oracle@dev:/u05/oradata/AIG1/data$find . -mtime +0
./system.dbf
./undo_01.dbf
./amig_tbs.dbf
./redo1_2a.dbf
./redo1_2b.dbf
./redo1_3a.dbf
./redo1_3b.dbf
oracle@dev:/u05/oradata/AIG1/data$

oracle@dev:/u05/oradata/AIG1/data$find . -mtime -1
./control_01.dbf
./control_02.dbf
./redo1_1a.dbf
./redo1_1b.dbf
oracle@dev:/u05/oradata/AIG1/data$
I am sure if there were files modified on "Nov 30" in this directory, those would have listed in "find . -mtime +1"

Thanks and Regards,
Chetana
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk script giving unstable results Anteus Shell Programming and Scripting 10 08-14-2009 02:24 AM
egrep not giving desired results igandu Shell Programming and Scripting 3 11-14-2007 03:43 AM
find . -mtime topcat8 UNIX for Dummies Questions & Answers 1 04-26-2006 10:55 AM
Script giving wrong results.... mgirinath Shell Programming and Scripting 1 12-21-2005 08:45 PM
find -mtime off by one day? ceanntrean UNIX for Dummies Questions & Answers 4 08-24-2005 07:46 PM



All times are GMT -4. The time now is 02:54 AM.