Пример #1
0
  private void start(String[] arguments, CtrlCHandler signalHandler) {
    Args args = Args.withFlags(ARG_READONLY).parse(arguments);
    if (args.has("?") || args.has("h") || args.has("help") || args.has("usage")) {
      printUsage();
      return;
    }

    String path = args.get(ARG_PATH, null);
    String host = args.get(ARG_HOST, null);
    String port = args.get(ARG_PORT, null);
    String name = args.get(ARG_NAME, null);
    String pid = args.get(ARG_PID, null);

    if ((path != null && (port != null || name != null || host != null || pid != null))
        || (pid != null && host != null)) {
      System.err.println(
          "You have supplied both "
              + ARG_PATH
              + " as well as "
              + ARG_HOST
              + "/"
              + ARG_PORT
              + "/"
              + ARG_NAME
              + ". "
              + "You should either supply only "
              + ARG_PATH
              + " or "
              + ARG_HOST
              + "/"
              + ARG_PORT
              + "/"
              + ARG_NAME
              + " so that either a local or "
              + "remote shell client can be started");
    }
    // Local
    else if (path != null) {
      try {
        checkNeo4jDependency();
      } catch (ShellException e) {
        handleException(e, args);
      }
      startLocal(args, signalHandler);
    }
    // Remote
    else {
      String readonly = args.get(ARG_READONLY, null);
      if (readonly != null) {
        System.err.println(
            "Warning: -" + ARG_READONLY + " is ignored unless you connect with -" + ARG_PATH + "!");
      }

      // Start server on the supplied process
      if (pid != null) {
        startServer(pid, args);
      }
      startRemote(args, signalHandler);
    }
  }
Пример #2
0
  void run(String... args) throws ToolFailureException {
    Args arguments = Args.withFlags(RECOVERY, PROP_OWNER).parse(args);
    String storeDir = determineStoreDirectory(arguments);
    Config tuningConfiguration = readTuningConfiguration(storeDir, arguments);

    attemptRecoveryOrCheckStateOfLogicalLogs(arguments, storeDir);

    StringLogger logger = StringLogger.SYSTEM;
    try {
      consistencyCheckService.runFullConsistencyCheck(
          storeDir, tuningConfiguration, ProgressMonitorFactory.textual(System.err), logger);
    } catch (ConsistencyCheckIncompleteException e) {
      throw new ToolFailureException("Check aborted due to exception", e);
    } finally {
      logger.flush();
    }
  }