Skip to content

Instantly share code, notes, and snippets.

@knalli
Forked from negokaz/jstatd.service
Created May 15, 2019 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knalli/b7117309092eaaae7c748e680e7b5d5e to your computer and use it in GitHub Desktop.
Save knalli/b7117309092eaaae7c748e680e7b5d5e to your computer and use it in GitHub Desktop.
# /etc/systemd/system/jstatd.service
#
# Install:
# - Put this file on /etc/systemd/system/jstatd.service
# - Rewrite <host ip>
#
# Usage:
# sudo systemctl enable jstatd
# sudo systemctl start jstatd
#
[Unit]
Description=Monitors Java Virtual Machines (JVMs) and enables remote monitoring tools to attach to JVMs.
[Service]
Type = simple
ExecStartPre = /bin/bash -c "echo -e 'grant { permission java.security.AllPermission; };' > /etc/jstatd.policy"
ExecStart = /usr/bin/jstatd -J-Djava.security.policy=/etc/jstatd.policy -J-Djava.rmi.server.hostname=<host ip>
[Install]
WantedBy = multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment