Skip to content

Instantly share code, notes, and snippets.

@ashishb888
Last active July 17, 2020 10:15
Show Gist options
  • Save ashishb888/86b8ace3ba746ecb187a7fa52ae64463 to your computer and use it in GitHub Desktop.
Save ashishb888/86b8ace3ba746ecb187a7fa52ae64463 to your computer and use it in GitHub Desktop.
JFR script
#!/bin/bash
pid=$1
appName=$2
fileName=$3
delay=$4
duration=$5
timestamp=`date +%FT%H-%M-%S`
$JAVA_HOME/bin/jcmd $pid VM.unlock_commercial_features
$JAVA_HOME/bin/jcmd $pid JFR.start name=$appName delay=$delay duration=$duration filename=$fileName/$appName-$timestamp.jfr
$JAVA_HOME/bin/jcmd $pid JFR.check
#Calling the script
#bash jfr.sh 201037 test-app /var/tmp/ 1s 15m
#/var/tmp/test-app-2020-07-17T11-00-17.jfr
#bash jfr.sh 228878 test-app /var/tmp 15m 15m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment