/** Runs commands across sessions */ @Action(value = "/terms/runCmd") public String runCmd() { Long userId = AuthUtil.getUserId(servletRequest.getSession()); if (userId != null) { try { // if id then write to single system output buffer if (idList != null && idList.size() > 0) { for (Long id : idList) { // get servletRequest.getSession() for user UserSchSessions userSchSessions = userSchSessionMap.get(userId); if (userSchSessions != null) { SchSession schSession = userSchSessions.getSchSessionMap().get(id); if (keyCode != null) { if (keyMap.containsKey(keyCode)) { schSession.getCommander().write(keyMap.get(keyCode)); } } else { schSession.getCommander().print(command); } } } } } catch (Exception ex) { ex.printStackTrace(); } } else { AuthUtil.deleteAllSession(servletRequest.getSession()); } return null; }