RE: mtime removing exports Linux

From: Sweetser, Joe <JSweetser_at_icat.com>
Date: Mon, 22 Aug 2011 14:24:43 +0000
Message-ID: <D18D6513433DF04394041EA42B53E91C43D8EE1D_at_ICATEXCH2.ICAT.com>



Somewhat in this vein, with RH (and I guess OEL) you can get a little better window of accuracy by using the +mmin qualifier to the find command, which is minutes as opposed to days.

-joe

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Dunbar, Norman (Capgemini) Sent: Monday, August 22, 2011 7:55 AM
To: pdba1966_at_hotmail.com; oracle-l_at_freelists.org 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

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



Confidentiality Note: This message contains information that may be confidential and/or privileged. If you are not the intended recipient, you should not use, copy, disclose, distribute or take any action based on this message. If you have received this message in error, please advise the sender immediately by reply email and delete this message. Although ICAT Managers, LLC, Underwriters at Lloyd's, Syndicate 4242, scans e-mail and attachments for viruses, it does not guarantee that either are virus-free and accepts no liability for any damage sustained as a result of viruses. Thank you.

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Aug 22 2011 - 09:24:43 CDT

Original text of this message