Skip to content

Instantly share code, notes, and snippets.

@negokaz
Last active August 6, 2020 04:22
Show Gist options
  • Save negokaz/fb6c2496939feeb929b14a785cc73e24 to your computer and use it in GitHub Desktop.
Save negokaz/fb6c2496939feeb929b14a785cc73e24 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