I have one issues using expectit + jcsh module. Here is the issues description.
expect.expect(contains("#"));
String command = "sh -x /tmp/custom.sh update > /tmp/output.log 2>&1";
expect.sendLine(command);
expect.expect(contains("#"));
expect.sendLine("exit");
When i see the output.log, it seems that half of script output only logged. Inside script, am using for loop command to iterate multilple users to check home dir exists of not, if not create dir accordingly.
But if am going to insert sleep command, then total script output logged correctly.
expect.sendLine(command);
try { Thread.sleep(100000); } catch(Exception ex){}
But i really need a solution, how we can use sleep time incrementally based on the script execution time until final output. If we use less number of loop, then sleep time need to be minimal.
Could you please advice me correct solution if any or how to handle sleep time incrementally in order to complete shell script completion.
Thanks in advance.
Murugavel