Contents |
getting du to just list child directory sizes
[~]$ sudo du -h --max-depth=1 /home/ 1.5M /home/booboo 28K /home/logs 8.2M /home/fishmonger 104K /home/whence 16K /home/lost+found 916K /home/nestor 330M /home/reassembler 283M /home/werner 344K /home/layabout 623M /home/ [~]$
# define extra args for monitoring JCONSOLE_ARGS=' -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8004 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:+HeapDumpOnCtrlBreak -XX:+HeapDumpOnOutOfMemoryError ' # this line begins with a apace, ' ' and a quote, "'", please leave it that way the important bits here are the quotes that start and end the assignment, the new lines are turned into spaces
example:
sudo jstat -gc -t `sudo jps|grep -i bootstrap|gawk '{print $1}'`;
explanation:
there are 4 parts to the command above.
sudo jps # get all java pids
grep -i bootstrap # look for the on that has the word bootstrap in its command
gawk '{print $1}' # parse into fields and print the first field, that's the pid
sudo jstat -gc -t # run the jstat command against the pid
cronned this job to count open files
#!/bin/bash DATE=$(date +"%Y%m%d%H%M") LINES=`sudo /usr/sbin/lsof` LINE_FILE=oflistfiles/open_file_list_$DATE.txt echo "$LINES" >>$LINE_FILE LOG_FILE=openfiles.log # log open tcp connections TCP=`sudo /usr/sbin/lsof|grep TCP|wc -l` # log regular open files REGULAR=`sudo /usr/sbin/lsof|grep REG|wc -l` # all files ALL=`sudo /usr/sbin/lsof|wc -l` LINE=`date`" - TCP($TCP), REG($REGULAR), ALL($ALL) - $LINE_FILE" echo $LINE >>$LOG_FILE -- produces a log file like this: Mon Jan 18 13:33:02 EST 2010 - TCP(159), REG(2856), ALL(3738) - oflistfiles/open_file_list_201001181301.txt Mon Jan 18 13:34:02 EST 2010 - TCP(164), REG(2896), ALL(3788) - oflistfiles/open_file_list_201001181301.txt Mon Jan 18 13:35:01 EST 2010 - TCP(175), REG(2856), ALL(3754) - oflistfiles/open_file_list_201001181335.txt Mon Jan 18 13:36:03 EST 2010 - TCP(179), REG(2794), ALL(3669) - oflistfiles/open_file_list_201001181336.txt