I've an java app named my-app
which is running from specific user my-app-user
and I want to take thread dumps once in a hour. I found jstack
which is bundled with JDK and I want to execute it with -l
flag. But, unfortunately I found that I should run jstack as my-app-user
user if I want to get my thread dump. The problem is that jstack has root:root ownership and I can't change it. Are there some workaround for this problem? I have no idea how can I resolve this.
Thanks
$ sudo -u my-app-user jstack -l
Reference: http://linux.die.net/man/8/sudo