RE: mtime removing exports Linux

  • From: <Joel.Patterson@xxxxxxxxxxx>
  • To: <norman.dunbar.capgemini@xxxxxxxxxxxxxxxxxxxxxxxxx>, <pdba1966@xxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 22 Aug 2011 10:49:10 -0400

Same as rm -rf / eh?

There is also the issue/argument to use xargs instead of exec, speed... exec 
spawns a process for each iteration I believe.   There has been discussions on 
this forum, so probably could google archives if interested.  (I am using exec 
in a lot of circumstances, but I forgot why).

Joel Patterson
Database Administrator
904 727-2546

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Dunbar, Norman (Capgemini)
Sent: Monday, August 22, 2011 9:55 AM
To: pdba1966@xxxxxxxxxxx; oracle-l@xxxxxxxxxxxxx
Subject: RE: mtime removing exports Linux

Afternoon P D,

>> I only want to keep one copy of an export on the server.   I 
>> have got this in a script on a Linux RHEL5 server.   It 
>> saves 3 days though instead of 1 and even if I put mtime 0 
>> it still saves more than one.    What is wrong with it?  
>>  
>> find $EXPORT_DIR -name "*" -mtime +1 -exec rm -rf {} \; > /dev/null

You are aware, as I was not, that "-mtime+1" means "one day ago, from the 
moment I typed this command"? 

The above command, if executed at 07:30:34 on 22 August 2011, will keep all 
files dated 07:30:34 from 21 August 2011 and later? One day ago is taken 
literally in this case.

Have you checked to be sure that the files remaining after the command has 
executed do actually meet the criteria of being older than 24 hours? One other 
thing, I'd be loath to run that command myself (experience!) as in the unlikely 
event of £EXPORT_DIR not having a value, and you being in / as root, bad things 
will happen! How do I know? :-(


Cheers,
Norm.

Norman Dunbar
Contract Senior Oracle DBA
Capgemini Database Team (EA)
Internal : 7 28 2051
External : 0113 231 2051


Information in this message may be confidential and may be legally privileged. 
If you have received this message by mistake, please notify the sender 
immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should 
still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under 
the Freedom of Information Act, Data Protection Act or for litigation.  Email 
messages and attachments sent to or from any Environment Agency address may 
also be accessed by someone other than the sender or recipient, for business 
purposes.

If we have sent you information and you wish to use it please read our terms 
and conditions which you can get by calling us on 08708 506 506.  Find out more 
about the Environment Agency at www.environment-agency.gov.uk
--
//www.freelists.org/webpage/oracle-l


--
//www.freelists.org/webpage/oracle-l


Other related posts: