Code Repositories
Find and share code repositories
Cloudera Employee
Repo Description

You can use this script to automatically take jstacks. Copy the script and just execute something like: <./>. Please let me know if this helps. It works on the basis of jstack -F , for systems which are very busy you can replace it with kill -3 pid.

[root@node1 ~]# ./
Which component are you looking to take a jstack for:
Process name is :   namenode
Process id for namenode is: 15046
How many jstack required:
Sleep between each jstack
Process Id for Namenode: 15046
Taking a jstack now
Process Id for Namenode: 15046
Taking a jstack now
Repo Info
Github Repo URL
Github account name sarunsingla/admin_utilities/blob/master
Repo name
Super Guru

@ssingla - Taking jstack with the user who is running a daemon would be more effective. Just a suggestion! :)

"Make sure to run jstack as the same user that's running Jenkins itself instead of using the root user" -

One more reference -