scripts/jvm-jstat-make
author Tomas Zeman <tzeman@volny.cz>
Fri, 07 Sep 2012 11:14:29 +0200
changeset 19 08238959d9fc
parent 11 ab5293025139
permissions -rwxr-xr-x
scripts/domain-check by Matty (http://www.cyberciti.biz/files/scripts/domain-check-2.txt)

#!/bin/sh

# Makes statistics for JVM via jstat.
# Invocation:
# jvm-jstat-make <name> <pid>
#	where name is symbolic name (service name etc.)
#	  and pid is process id (as reported by jps(1) or ps(1) )

if [ -z "$1" -o -z "$2" ]; then
	echo -e "Missing service name or pid"
	exit 1
fi

JSTAT="sudo jstat"
UID=`id -u`
N=$1
PID=$2
D=/tmp/jvm-jstat-$UID-$N

[ -d $D ] || mkdir -p $D

$JSTAT -options | sed -e 's/-//' | while read op; do
	$JSTAT -$op $PID > $D/$op
done