- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: System Cleanup Warning/Alerting Script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 09:43 AM
05-12-2002 09:43 AM
1. Find files that are older than x days (let's use 180 days for example).
2. Also look for files with common patterns such as (.dmp, .log, .txt, core*, .out, etc.)
3. Break down listings of these files by owner and email their own list to each user account to inform them that the files were created so long ago and he/she need to review if these need to be removed.
I need to do some major maintenance in our system and many users have created files and left them all over the place and I don't want to personally remove them without consulting with their creators.
My major concern is to targe big output files that are no longer of any use by their owners or anyone else and are just taking precious space. Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 12:28 PM
05-12-2002 12:28 PM
SolutionYou could walk a list, by example, like this:
# for USER in user1 user2 user3
> do
> find /tmp \( -type f -name "*.log" -a -user $USER -a -mtime +180 \) > $HOME/${USER}.files
> if [ -s "$HOME/${USER}.files" ]
> then
> echo "no files matching criteria for $USER"
> else
> mailx -s "Old File List" $USER < $HOME/${USER}.files
> fi
> done
Have a look at the man pages for 'find' for more information. As written, the example looks at the /tmp directory for files ('type f') whose name ends in '.log'. The files must also belong to $USER and have been modified in 180 or more days. Note that a space surrounds the escaped parentheses. Note also that the wildcarded 'name' argument is escaped with double quote marks to prevent the shell from expanding the name before the 'find' command processes it.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 01:07 PM
05-12-2002 01:07 PM
Re: System Cleanup Warning/Alerting Script
Thanks, I just hope I get more input from others!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 02:10 PM
05-12-2002 02:10 PM
Re: System Cleanup Warning/Alerting Script
NOTE: if umask has never been set, then everything you have created as root is contaminated! The reason is that root has created dozens, perhaps hundreds of directories and files that have world-writable permissions--very bad. And you can safely assume that every file and directory has been trashed in one way or another. To see what this looks like:
find / /opt /usr -xdev -perm -002 -exec ls -ld {} \;
And what this means is that users have scattered all of their files all over the system. So cleanup will be complicated by the open permissions in so many directories. But I would still be ruthless to put the storage space under control. The vast majority of the removed files will be junk and if someone really needs their special file from /tmp, you can restore it (in the near future).
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 02:41 PM
05-12-2002 02:41 PM
Re: System Cleanup Warning/Alerting Script
However, my view is: "If it is broken or seems broken try to fix it". I do not think it's too late, but I will need active participation from users; eventually I may need to be a little merciless, but I am not thinking about getting there yet.
For now, I will need some active participation and then as the number of dumped junk files decreases, organization may finally come back under control. Bill, thanks for your input though!
We are getting the opportunity to start fresh on a new production server, and this one I am working on will become a test/development server. Lessons learned here will serve the future environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2002 03:03 AM
05-13-2002 03:03 AM
Re: System Cleanup Warning/Alerting Script
While I think your approach is admirable if not downright noble, I think you will find the "active participation" of users to be frustratingly elusive. By all means, give it a try and I wish you luck with it, but I think ultimately you're going to have to go to Bill's approach simply to save your sanity.
Best of luck,
Pete
Pete