System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting CORE files (temporarily as root)

SOLVED
Go to solution
William Calvin Wilkins
Occasional Visitor

Deleting CORE files (temporarily as root)

I can use the following script below when I'm logged in as ROOt...however, I would like my Computer Operator to run this script without ROOT access. Is there a way to have the script switch the user to ROOT then run the script...then switch the user back to their original login? Thanks, Will

find / -name core -type f -prune -exec rm -f {} \;
5 REPLIES
Alex Glennie
Honored Contributor
Solution

Re: Deleting CORE files (temporarily as root)

http://en.wikipedia.org/wiki/Sudo

http://www.gratisoft.us/sudo/download.html

user once configured types sudo and is prompted for their own password
Alex Glennie
Honored Contributor

Re: Deleting CORE files (temporarily as root)

why not just add the above as a cron job for the root user once a day ? just a thought : no points for this please

William Calvin Wilkins
Occasional Visitor

Re: Deleting CORE files (temporarily as root)

Hey Alex, that's a great idea. Thanks so much. Have a Great Weekend.
Bill Hassell
Honored Contributor

Re: Deleting CORE files (temporarily as root)

> find / -name core ...

is a very brute force and disk intensive method to get rid of core files. Why not eliminate all core files with:

ulimit -Sc 0

Put this into /etc/profile and now all your user-created core files will no longer be created. If there are application-created core files, put the ulimit -0 Sc command inside the startup scripts.

However, if you are running 11.31, you can use the coreadm command to eliminate the core files. This all assumes that you cannot fix the failures causing the core files.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: Deleting CORE files (temporarily as root)

>find / -name core -type f -prune -exec rm -f {} \;

Not sure why you have -prune?
You can speed up the rm by using -exec ... +
find / -name core -type f -exec rm -f {} +