I'm performing network
service restart in java as below.
String[] serviceStop = { "service","network","restart" };
Process networkProc = new ProcessBuilder(serviceStop).start();
networkProc.waitFor();
Integer returncode=networkProc.exitValue();
which returns success code even if it is still restarting.
but I need to make sure restart went successfully and return once complete by checking the network service
status. how to achieve this in Java?