[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: [cobalt-users] root partition is at 93%



Hello Steve,

Tuesday, November 26, 2002, 12:01:15 PM, you wrote:


SW> <rdkurth@xxxxxxxxxxxx> wrote:
>> My /dev/hda1 (root) partition is at 93% is there a command line Command
SW> that
>> will show me what is filling up this partition. I need to stop it
>> before it kills my server.

SW> find.  man find.  Here's a script I wrote that checks the entire server for
SW> files over 1 million bytes and saves their directory listings to a log file
SW> sorted in reverse order of filesize.  It should tell you what you need.
SW> Feel free to edit as necessary.  YMMV and I'm not liable for anything that
SW> happens if you use the script, though it works for me on numerous servers.

SW> #!/bin/sh

SW> LOG_FILE_DIR=/home/log/large_files
SW> # 1 million bytes is ~ 1 MB.
SW> SIZE_BYTES=1000000

SW> [ -d $LOG_FILE_DIR ] || mkdir -p $LOG_FILE_DIR

SW> DATE_TODAY=`date "+%Y-%m-%d"`

SW> find / -size +"${SIZE_BYTES}c" -type f -exec ls -l '{}' ';' | sort +4 -nr >
SW> $LOG_FILE_DIR/large_files-$DATE_TODAY

SW> chown -R admin:admin $LOG_FILE_DIR


I keep getting this error message when I try to use the script

syntax error near unexpected token `>'
./test:line 11: `find / -size +"${SIZE_BYTES}c" -type f -exec ls -l '{}' ';' | sort +4 -nr > '


-- 
Best regards,
 rdkurth                            mailto:rdkurth@xxxxxxxxxxxx