I have a Node Js program that has three parts to it.
The first part executes and returns the IP and User The second part is calling the following shellscript
#!/bin/bash
IP=$1
User=$2
ssh -i /Users/cer.pem ubuntu@$IP "cd /home/$ && ls -lth" >> /Users/outcome.txt
Upon successful creation of the outcome.txt, I have to continue doing other stuff in the third part.
I did find two items relevant to thi Run shell script with node.js (childProcess) & Node.js Shell Script And Arguments, but these arent exactly solving my problem as it doesnt talk handling the sync nature of shellsrcipt.
More info about how to really work with child_process would really help. 1) How do I pass the IP and User to the 2nd node module embedding the shellscript? 2) How do I extract the dir listing from the outcome of shellscript?
Can anyone please help me here?