You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/08/10 13:53:19 UTC
[22/30] ignite git commit: IGNITE-5987 Added -nq (visor will not quit
in batch mode) option for Visor Cmd.
IGNITE-5987 Added -nq (visor will not quit in batch mode) option for Visor Cmd.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8d6e8420
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8d6e8420
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8d6e8420
Branch: refs/heads/ignite-5872
Commit: 8d6e8420fdf1fcd853277704fd68c2d48ac1012d
Parents: 5a559df
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Aug 9 18:55:04 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Aug 9 18:55:04 2017 +0700
----------------------------------------------------------------------
.../org/apache/ignite/visor/commands/VisorConsole.scala | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8d6e8420/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index 19d130e..d53a0d5 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -92,6 +92,7 @@ class VisorConsole {
println(" -cfg=<path> - connect with specified configuration.")
println(" -b=<path> - batch mode with file.")
println(" -e=cmd1;cmd2;... - batch mode with commands.")
+ println(" -nq - batch mode will not quit after execution (useful for alerts monitoring).")
visor.quit()
}
@@ -103,6 +104,10 @@ class VisorConsole {
val cfgFile = argValue("cfg", argLst)
val batchFile = argValue("b", argLst)
val batchCommand = argValue("e", argLst)
+ val noBatchQuit = hasArgName("nq", argLst)
+
+ if (noBatchQuit && batchFile.isEmpty && batchCommand.isEmpty)
+ visor.warn("Option \"-nq\" will be ignored because batch mode options \"-b\" or \"-e\" were not specified.")
cfgFile.foreach(cfg => {
if (cfg.trim.isEmpty) {
@@ -149,7 +154,10 @@ class VisorConsole {
case Some(cmd) =>
visor.batchMode = true
- new ByteArrayInputStream((cmd + "\nquit\n").getBytes("UTF-8"))
+ val script = if (noBatchQuit) cmd else cmd + "\nquit\n"
+
+ new ByteArrayInputStream(script.getBytes("UTF-8"))
+
case None => new FileInputStream(FileDescriptor.in)
}
@@ -159,7 +167,7 @@ class VisorConsole {
new TerminalSupport(false) {}
} catch {
- case ignored: ClassNotFoundException => null
+ case _: ClassNotFoundException => null
}
val reader = new ConsoleReader(inputStream, System.out, term)