Пример #1
0
  @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;
    }
  }
Пример #2
0
 public int getStartLevel() throws Exception {
   return systemService.getStartLevel();
 }
Пример #3
0
 public void setStartLevel(int startLevel) throws Exception {
   systemService.setStartLevel(startLevel);
 }
Пример #4
0
 public void reboot(String time, boolean clean) throws Exception {
   systemService.reboot(time, clean);
 }
Пример #5
0
 public void reboot() throws Exception {
   systemService.reboot();
 }
Пример #6
0
 public void halt(String time) throws Exception {
   systemService.halt(time);
 }
Пример #7
0
 public void halt() throws Exception {
   systemService.halt();
 }