@Override public Object execute() throws Exception { if (force) { if (reboot) { systemService.reboot(time, determineSwipeType()); } else { systemService.halt(time); } return null; } for (; ; ) { String karafName = System.getProperty("karaf.name"); String msg; if (reboot) { msg = String.format("Confirm: reboot instance %s (yes/no): ", karafName); } else { msg = String.format("Confirm: halt instance %s (yes/no): ", karafName); } String str = null; try { str = session.readLine(msg, null); } catch (UnsupportedOperationException e) { // this is a remote client with shutdown argument so here isn't a interactive way // so return a prompt message instead of NPE System.out.println( "please use \"shutdown -f\" or \"shutdown --force\" to shutdown instance: " + karafName); return null; } if (str.equalsIgnoreCase("yes")) { if (reboot) { systemService.reboot(time, determineSwipeType()); } else { systemService.halt(time); } } return null; } }
public int getStartLevel() throws Exception { return systemService.getStartLevel(); }
public void setStartLevel(int startLevel) throws Exception { systemService.setStartLevel(startLevel); }
public void reboot(String time, boolean clean) throws Exception { systemService.reboot(time, clean); }
public void reboot() throws Exception { systemService.reboot(); }
public void halt(String time) throws Exception { systemService.halt(time); }
public void halt() throws Exception { systemService.halt(); }