Created
March 12, 2014 13:52
-
-
Save jhinrichsen/9507346 to your computer and use it in GitHub Desktop.
Java VM uptime, useful to check if a service has been restarted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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