find command impact.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

find command impact.

raiq1
Dear Erman,

We are house keeping our EBS application and delete all the files that has occupy the space.

I have used cronjobs for this purpose to delete the files in one attempt, last time I got the impact and the command not only delete the core files but also delete the files inside the server directory.


#30 23 * * 5 find /u02/oracle/PROD/inst/apps/PROD_prodapp12/ora/10.1.2/forms/ -type f -mtime +7 -print -exec rm core*.* {} \; >>  /u01/cronjobs/logs/del_core_files_`date "+\%d\%m\%Y"`.log


Where is the mistake in this cronjob , my action plan  is to delete the core files only

in /u02/oracle/PROD/inst/apps/PROD_prodapp12/ora/10.1.2/forms/

But unfortunately it has not only delete the core files but inside the files under server directory.

Kindly help me to correct the command ,Hope you understand my query.

Regards,
Raiq
Reply | Threaded
Open this post in threaded view
|

Re: find command impact.

ErmanArslansOracleBlog
Administrator
Why dont you directly find the core files and delete them? I mean -> modify your find command accordingly..  You should use -name argument.

Ex: find /erman -type f -name "core*"  and then you will write to the rest of the command (including the -exec part..) You don't need to put core there in the end of the command this way..

Note that -> Test these things in your TEST environment.. *This is a deletion test, so it is dangerous! The risk is yours!

First test the "find" part of the command.. Then if you satisfy with the output (the findings) then add the rest of the command..  First ensure you can find those files, ensure that you re safe.. Only then add the -exec part..