Quarterly delete files older than 3 months

bongalegre's Avatar, Join Date: Apr 2010
Newbie Member
Hi Guys,

I really hope you could help me I am just new in Oracle but my boss is forcing me to do scripting he said everything is available online. I tried to create but he said it was wrong maybe you can give me a helping hand.

This will be my crontab entry
#!/bin/sh
#* * 1 1,4,7,10 * /root/bin/OLP-Cleanup.sh

And this will be script run by OLP-Cleanup.sh
find /root/archive -mtime +90 -exec rm {} \;

He said this wil delete all the files in Archive?
Any suggestions? Thanks!

/bong
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
#* * 1 1,4,7,10 *

Do you have any idea what that number actually mean?
0
bongalegre's Avatar, Join Date: Apr 2010
Newbie Member
My intentions is to run the script on 1st day of Jan, Apr, Jul, oct. Is it wrong?
I got this as reference from somewhere

at that interval.

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
No it is right but you should specify the hour and minute if you want it to run only once.

So now the question comes what is the issue?

If it deletes all the files means your script contains error.
0
bongalegre's Avatar, Join Date: Apr 2010
Newbie Member
hmm actually we haven't tried this yet. based from my boss assumption he thought this may not work.
But I demanded that this will not delete the file cause I set the run command to delete files +90 days old only.

Just to make sure before he gets back I want to get a second opinion or if you have a better approach for the said purpose? Thanks!
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
This will make the script to run after 90 days but not sure what it will do when run is the question.