Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Oracle (http://www.go4expert.com/forums/oracle-forum/)
-   -   Quarterly delete files older than 3 months (http://www.go4expert.com/forums/quarterly-delete-files-3-months-t21929/)

bongalegre 28Apr2010 10:47

Quarterly delete files older than 3 months
 
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

shabbir 28Apr2010 10:50

Re: Quarterly delete files older than 3 months
 
#* * 1 1,4,7,10 *

Do you have any idea what that number actually mean?

bongalegre 28Apr2010 10:56

Re: Quarterly delete files older than 3 months
 
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)

shabbir 28Apr2010 11:11

Re: Quarterly delete files older than 3 months
 
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.

bongalegre 28Apr2010 11:45

Re: Quarterly delete files older than 3 months
 
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!

shabbir 28Apr2010 11:46

Re: Quarterly delete files older than 3 months
 
This will make the script to run after 90 days but not sure what it will do when run is the question.


All times are GMT +5.5. The time now is 10:15.