Skip to content

Instantly share code, notes, and snippets.

@jhinrichsen
Created March 12, 2014 13:52
Show Gist options
  • Save jhinrichsen/9507346 to your computer and use it in GitHub Desktop.
Save jhinrichsen/9507346 to your computer and use it in GitHub Desktop.
Java VM uptime, useful to check if a service has been restarted
def ms = java.lang.management.ManagementFactory.getRuntimeMXBean().getUptime()
def s = ms / 1000
def min = s / 60
def hours = min / 60
println "Uptime: ${s} seconds/ ${min} minutes/ ${hours} hours."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment