Operating System - HP-UX
1837173 Members
2770 Online
110113 Solutions
New Discussion

Re: Enable monitor core files processes of other users

 
Vic S. Kelan
Regular Advisor

Enable monitor core files processes of other users

Hello all,

I have these scripts belonging to a user, e.g user1. Basically it scans the system for user1's core files and prints a summary report.

How can i get it to scan for other user core & processes and possibly delete them after a certain period.......user1 has no root privileges....
5 REPLIES 5
Devender Khatana
Honored Contributor

Re: Enable monitor core files processes of other users

Hi,

Attach the script. Also the default permission of core files is perhaps -rw------- . This cause the core file for a user to be deleted by only that user and nobody else. So a better way will be to run that script after modification from the user for which you want to remove core files.

HTH,
Devender
Impossible itself mentions "I m possible"
A. Clay Stephenson
Acclaimed Contributor

Re: Enable monitor core files processes of other users

The ownership of a file has nothing to do with the ability to delete a file (unless the sticky bit is set on the directory); the permissions of the directory determine whether or not a file can be deleted. Unless you want to open up the write permissions on directories (a dumb idea) then you need to leave this operation to root --- or setup a sudo process to do this. A reasonable approach would be to setup a cronjob running as root to do this task periodically.
If it ain't broke, I can fix that.
Vic S. Kelan
Regular Advisor

Re: Enable monitor core files processes of other users

Hi Guys,

Thanks both for your response, I have attached the script.....maybe u'd be able to explain it even better 2 me as it was inherited......and am no script whiz.....

I wont want to set up a sudo to the account as a couple of users have access to the account.......

also a great idea to set cronjob as root to deal with this.....any tips based on the attached script please?

thanks
Greg Vaidman
Respected Contributor

Re: Enable monitor core files processes of other users

Vic,

The attached script doesn't look like it has anything to do with removing core files.

If you have a system where noone is ever going to analyze core files, then you should look into preventing them from being created, rather than cleaning up after the fact. Take a look at the ulimit command and the options related to limiting the sizes of core files. Then find a good place near the end of /etc/profile to put the appropriate ulimit command. Note that this doesn't prevent users from running ulimit within their own shells to change the parameter, but it's a much simpler solution that takes care of the majority of the problem.

--Greg
Senthil Kumar .A_1
Honored Contributor

Re: Enable monitor core files processes of other users

As per clay's sugesstion
you include the following line in roots crontab file...

0 12 * * * find / -name core -exec rm {} \;
This entry would delete core files in the entire sysem everyday at 12 noon.
make sure u wouldn't want any core files to be analysed on this system. Because it is not advisable to delete all the core files, as it might be needed sometimes by HP to analyse the issue using the core files. Please be aware that the above entry would also delete any file that was named "core" ..that means even a user created genuine files named "core".

In case if u wanna add please use "crontab -e" to add the entry to roots crontab.

If i were you i wouldn't use it before giving a second thought..

Though Gregs suggestion sounds more logical, but wan't able to check the options for "ulimit".. would try getting one...

Regards
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)