public static boolean isAlluxioRunning ( String className ) { String [ ] command = { "bash" , "-c" , "ps -Aww -o command | grep -i \"[j]ava\" | grep " + className } ; try { Process p = Runtime . getRuntime ( ) . exec ( command ) ; try ( InputStreamReader input = new InputStreamReader ( p . getInputStream ( ) ) ) { if ( input . read ( ) >= 0 ) { return true ; } } return false ; } catch ( IOException e ) { System . err . format ( "Unable to check Alluxio status: %s.%n" , e . getMessage ( ) ) ; return false ; } }
Checks whether an Alluxio service is running .