- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: HPUX 11.0: ...Idenifying Files That Grow
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
07-18-2003 11:24 AM
07-18-2003 11:24 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2003 11:37 AM
07-18-2003 11:37 AM
Re: HPUX 11.0: ...Idenifying Files That Grow
du -k . | sort -rn | more
I suppose you could script this and write the output to a file for future reference:
du -k . | sort -rn > /tmp/bigfiles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2003 03:06 PM
07-18-2003 03:06 PM
Re: HPUX 11.0: ...Idenifying Files That Grow
I would say you start monitoring your filesystem usage. Once you are notified with the filesystems that exceeded certain threshold, you can run "find" command only in that filesystem to determine the files that are growing. Look at man page of find. You will be interested in "size" option of it.
Below is a sample script that can send you an email if it finds any of the filesystems above 75%.
THRESHOLD=75
EMAIL="yourid@yourdomain.com"
for fs in $(df -F vxfs |awk '{print $1}')
do
USED=$(df -F vxfs -k $fs |awk '/allocation used/ {print $1}')
if [ $USED -ge $THRESHOLD ]
then
echo $fs $USED >> /tmp/tmp$$
fi
done
if [ $(cat /tmp/tmp$$|wc -l) -ge 1 ]
then
mailx -s "Filesystems above 75%" $EMAIL < /tmp/tmp$$
fi
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2003 04:06 PM
07-18-2003 04:06 PM
SolutionTHRESHOLD=85
EMAIL="yourid@yourdomain.com"
trigger=0
for fs in $(df -F vxfs |awk '{print $1}')
do
USED=$(df -F vxfs -k $fs |awk '/allocation used/ {print $1}')
# echo "post 1"
if [ $USED -ge $THRESHOLD ]
then
(( trigger = trigger + 1 ))
echo $fs $USED >> /tmp/tmp$$
fi
done
# echo "post 2 $trigger"
if [ $trigger -le 1 ]
then
echo "no overfull fs"
exit 0
fi
if [ $(cat /tmp/tmp$$|wc -l) -ge 1 ]
then
mailx -s "Filesystems above ${THREASHOLD}%" $EMAIL < /tmp/tmp$$
fi
Further revision will be required to run it in cron. PATH variable or full path of commands used.
Great script though.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2003 04:22 PM
07-18-2003 04:22 PM
Re: HPUX 11.0: ...Idenifying Files That Grow
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2003 06:29 PM
07-18-2003 06:29 PM
Re: HPUX 11.0: ...Idenifying Files That Grow
ll | sort -rnk5 | more
As far as HP-UX goes, 2 directories will always need cleanup help: /tmp and /var. /tmp is unfortunately misused as a general purpose temp directory (it is supposed to be opsystem use only) so it needs monitoring and regular file and directory removal.
/var is far more complicated since there are many different subsystems that use /var directories. For instance, if you use email or do a lot of printing, /var/mail and /var/spool may grow rapidly. /var/adm always grows because it is full of logfiles. And /var/adm/sw contains rollback files to be used to backup patches.
As with all scripted solutions, automatic removal or truncation is very dangerous without careful inspection of the file and it's purpose.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2003 11:17 PM
07-18-2003 11:17 PM
Re: HPUX 11.0: ...Idenifying Files That Grow
If you want to monitor files that GROW you'll have to create lists and compare those.
To get a list of large files on your system use find:
# find / -size +1000k -exec du -sk {} \;
That shows all files larger than 1000kb.
Redirect the output into a file.
Then wait some days.
Call again find and redirect the output to file (but with different filename ;)).
Then grab your favourite editor and write a small perl script:
Read the first list into a hash-array (key=filename, value=size).
Now read the new file.
Check for the filename in the hash. If the file is there, compare the size and you see what files grew or shrink. If the file is not in the hash you've got a new file which raised above 1mb.
If you enhance the routine a little bit you can also find large files which were removed.
That's the best solution to your question.
Regards
Joerg