Created
April 2, 2013 10:03
-
-
Save mrmichalis/5291192 to your computer and use it in GitHub Desktop.
Just run it like this:
sh jstackSeries.sh [pid] [cq5serveruser] [count] [delay] For example:
sh jstackSeries.sh 1234 cq5serveruser 10 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ $# -eq 0 ]; then | |
| echo >&2 "Usage: jstackSeries <pid> <run_user> [ <count> [ <delay> ] ]" | |
| echo >&2 " Defaults: count = 10, delay = 0.5 (seconds)" | |
| exit 1 | |
| fi | |
| pid=$1 # required | |
| user=$2 # required | |
| count=${3:-10} # defaults to 10 times | |
| delay=${4:-0.5} # defaults to 0.5 seconds | |
| while [ $count -gt 0 ] | |
| do | |
| sudo -u $user jstack -l $pid >jstack.$pid.$(date +%H%M%S.%N) | |
| sleep $delay | |
| let count-- | |
| echo -n "." | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment