find -mtime giving strage results in HP-UX


 
Thread Tools Search this Thread
Operating Systems HP-UX find -mtime giving strage results in HP-UX
# 1  
Old 12-03-2009
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 07:38 AM.. Reason: formatting
# 2  
Old 12-03-2009
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
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comm giving unexpected results

Hi I am comparing two files with comm -13 < (sort acc11.txt) < (sort acc12.txt) > output.txt purpose: Get non matching records which are in acc12 but not in acc11... TI am getting WRONG output. Is there any constraints with record length with comm? The above files are the two consective ... (2 Replies)
Discussion started by: vedanta
2 Replies

2. UNIX for Dummies Questions & Answers

Grep not giving expected results

Version: RHEL 5.8 I am doing a grep of the piped output from ps command as shown below. I am grepping for the pattern ora_dbw* . But, in the result set I am seeing strings with ora_dbr* as well like ora_dbrm_SDLM1DAS3 as shown below. Any idea why is this happening ? $ ps -ef | grep... (6 Replies)
Discussion started by: John K
6 Replies

3. UNIX for Dummies Questions & Answers

Find using mtime

Hi, so I was using mtime and its not behaving the way I would think its supposed too. I have two pdf files. One modified today and another 6 months ago. I upload them to the solaris server. Then I run the below find statements. This finds my 2 files find *.pdf -type f -name '*.pdf' this finds... (2 Replies)
Discussion started by: vsekvsek
2 Replies

4. Shell Programming and Scripting

Sed in vi - \r and \n not giving desired results

I use many different machines at work, each with different versions of o/s's and installed applications. Sed in vi is particularly inconvenient in the sense that sometimes it will accept the "\r" as a carriage return, sometimes not. Same thing with "\n". For instance, if I have a list of hosts... (7 Replies)
Discussion started by: MaindotC
7 Replies

5. Shell Programming and Scripting

find -mtime +7

Dear all, find $ADMIN_DIR/$SID/arch/ -name '*.gz' -mtime +7 -exec rm {} \; is it retaining 7 days OR 8 days .gz files ? Thanks Prakash (10 Replies)
Discussion started by: prakashoracledb
10 Replies

6. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

7. Shell Programming and Scripting

awk script giving unstable results

Hi all Here I came accross a situation which i am unable to reason out... snippet 1 psg ServTest | grep -v "grep" | grep -v "vi" | awk '{ pgm_name=$8 cmd_name="ServTest" gsub(/]*/,"",pgm_name) if(pgm_name==cmd_name) { print "ServTest Present =" cmd_name} }'... (10 Replies)
Discussion started by: Anteus
10 Replies

8. Shell Programming and Scripting

egrep not giving desired results

I have written a shell script which looks like below: grep -v ',0,' ./DATA/abc.001 > ./DATA/abc.mid egrep $GREPSEARCH ./DATA/ebc.mid > ./DATA/abc.cut the variable GREPSEARCH has values like the below: ... (3 Replies)
Discussion started by: igandu
3 Replies

9. UNIX for Dummies Questions & Answers

find . -mtime

...what am i doing wrong?? I need to find all files older than 30 days and delete but I can't get it to pull details for ANY + times. The file below has a time stamp which is older than 1 day, however if I try and select it using any of the -time flags it just doesn't see it. (the same thing... (1 Reply)
Discussion started by: topcat8
1 Replies

10. Shell Programming and Scripting

Script giving wrong results....

hi, I have this script which gives me the result... #! /usr/bin/sh set -x cd /home/managar a=1 while true do if then echo " File log.txt exists in this directory " exit 0 fi echo " File has not arrived yes..." sleep 3 let a=a+1 if then (1 Reply)
Discussion started by: mgirinath
1 Replies
Login or Register to Ask a Question