View previous topic :: View next topic |
Author |
Message |
fatcat.00 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 12 Aug 2002 Posts: 145
|
Posted: Sun Jun 08, 2003 2:25 pm Post subject: Check disk space used by Portage |
|
|
Here is a really simple script that checks various directories used by portage for temp files, source etc. There might be something like this already in gentools collection, but if there is I don't know about it.
I added this to a cron job so I am periodically notified via email how big things are getting. I have run out of disk space a couple times, but now this keeps that from happening.
Code: | #!/bin/bash
# -----------------------------------------------------------------------------
# PROGRAM: usedbyportage.sh
# : A simple script to check the size of certain
# : directories commonly used by portage.
# -----------------------------------------------------------------------------
# LICENSE: Released by the author to the Public Domain
# -----------------------------------------------------------------------------
# USAGE : usedbyportage.sh [depth]
# : where [depth] corresponds to the depth you want to look
# : into the given directory structure. Default is 0, but a
# : depth of 1 is useful too.
# Add whatever directories you want to check here
CHK_DIRS="/usr/portage/distfiles /var/cache/edb /var/tmp/portage"
WHITE=$'\e[1;37m'
GRAY=$'\e[0;37m'
GREEN=$'\e[1;32m'
YELLOW='\e[1;33m'
BLUE=$'\e[1;34m'
MAGENTA=$'\e[1;35m'
CYAN=$'\e[1;36m'
# If running as non-root, you will get errors when checking certain
# directories. STDERR is being dumped to the bitbucket, so you won't
# see the errors. Remove the "2>&1" if you want to see errors in the
# output.
for dir in $CHK_DIRS ; do
echo "$WHITE*** CHECKING$CYAN $dir $WHITE***$GRAY"
if [ -z "$1" ] ; then
du --max-depth=0 $dir 2>&1 | grep ^[0-9] | sort -g
else
du --max-depth=$1 $dir 2>&1 | grep ^[0-9] | sort -g
fi
done
|
_________________ -- Fatcat |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|