Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-676 [created] 4f87859cf


ignite-676


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4f87859c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4f87859c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4f87859c

Branch: refs/heads/ignite-676
Commit: 4f87859cfde16c900a06865c154388e4767f2b98
Parents: 71439bc
Author: Artem Shutak <ashu...@gridgain.com>
Authored: Wed Apr 8 16:39:58 2015 +0300
Committer: Artem Shutak <ashu...@gridgain.com>
Committed: Wed Apr 8 16:39:58 2015 +0300

----------------------------------------------------------------------
 .../util/nodestart/IgniteNodeCallableImpl.java  | 42 ++++++++++++++++++--
 1 file changed, 38 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f87859c/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
 
b/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
index 9b873bf..7029daf 100644
--- 
a/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
+++ 
b/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
@@ -124,6 +124,8 @@ public class IgniteNodeCallableImpl implements 
IgniteNodeCallable {
             String scriptOutputFileName = FILE_NAME_DATE_FORMAT.format(new 
Date()) + '-'
                 + UUID.randomUUID().toString().substring(0, 8) + ".log";
 
+            String fName = "";
+            
             if (win)
                 throw new UnsupportedOperationException("Apache Ignite cannot 
be auto-started on Windows from IgniteCluster.startNodes(…) API.");
             else { // Assume Unix.
@@ -143,21 +145,40 @@ public class IgniteNodeCallableImpl implements 
IgniteNodeCallable {
 
                     igniteHome = igniteHome.replaceFirst("~", homeDir);
                 }
+                
+                fName = igniteHome + "/" + scriptOutputFileName;
 
                 startNodeCmd = new SB().
                     // Console output is consumed, started nodes must use 
Ignite file appenders for log.
                         a("nohup ").
                     a("\"").a(igniteHome).a('/').a(scriptPath).a("\"").
                     a(" ").a(scriptArgs).
-                    a(!cfg.isEmpty() ? " \"" : "").a(cfg).a(!cfg.isEmpty() ? 
"\"" : "").
-                    a(rmtLogArgs).
-                    a(" > 
").a(scriptOutputDir).a("/").a(scriptOutputFileName).a(" 2>& 1 &").
+                    a(!cfg.isEmpty() ? " \"" : "").a(cfg).a(!cfg.isEmpty() ? 
"\"" : "").a(rmtLogArgs).a(" > ").a(fName).a(" 2>& 1 &").
                     toString();
             }
 
             info("Starting remote node with SSH command: " + startNodeCmd, 
spec.logger(), log);
 
             shell(ses, startNodeCmd);
+            
+            log.info(">>>>> Shelled");
+            
+            
+            log.info(">>>>> File name=" + fName);
+
+            try {
+                BufferedReader reader = new BufferedReader(new 
FileReader(fName));
+                
+                String st = "";
+                
+                for (String line; (line = reader.readLine()) != null;)
+                    st += line;
+                
+                log.info(">>>>> File content:\n" + st);
+            }
+            catch (Throwable e) {
+                e.printStackTrace();
+            }
 
             return new GridTuple3<>(spec.host(), true, null);
         }
@@ -184,21 +205,34 @@ public class IgniteNodeCallableImpl implements 
IgniteNodeCallable {
      */
     private void shell(Session ses, String cmd) throws JSchException, 
IOException, IgniteInterruptedCheckedException {
         ChannelShell ch = null;
+        
+        log.info(">>>>> Shell. ses=" + ses + ", cmd=" + cmd);
 
         try {
             ch = (ChannelShell)ses.openChannel("shell");
 
             ch.connect();
 
+            log.info(">>>>> Shell. Connected");
+
             try (PrintStream out = new PrintStream(ch.getOutputStream(), 
true)) {
+                log.info(">>>>> Shell. Printing to out");                
+                
                 out.println(cmd);
 
+                log.info(">>>>> Shell. Printed");
+
                 U.sleep(1000);
             }
         }
         finally {
-            if (ch != null && ch.isConnected())
+            if (ch != null && ch.isConnected()) {
+                log.info(">>>>> Shell. Disconnecting");                
+                
                 ch.disconnect();
+
+                log.info(">>>>> Shell. Disconnected");
+            }
         }
     }
 

Reply via email to