shanraj
asked on
Capture output of remote script execution
Hi
I do the following things on a remote linux box from a local linux box.
1. SCP a bash script to the remote system
2. SSH to the remote system and execute the bash script you copied in step 1.
3. Display the output of the remote script execution in the local machine.
I'm facing trouble with step 3. I could able to remotely execute the script. I verified this. But the script execution is not redirected to the local machine from where i'm executing.
What i have to do in my base script..?
I do the following things on a remote linux box from a local linux box.
1. SCP a bash script to the remote system
2. SSH to the remote system and execute the bash script you copied in step 1.
3. Display the output of the remote script execution in the local machine.
I'm facing trouble with step 3. I could able to remotely execute the script. I verified this. But the script execution is not redirected to the local machine from where i'm executing.
What i have to do in my base script..?
#!/bin/sh
#Master script I execute on the local machine
scp test.sh 192.168.1.10:/var/local
ssh 192.168.1.10 "sh /var/local/test/sh
#!/bin/sh
#Remote script
mkdir /var/local/testdir
echo "Created test directory"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
As Omarfarid said I routed the output to a local file and displayed the content of the file.
I also found another way. If you have arguments @$ in the main section of the script it displays the output without anything special. that's cool..
thanks for all.
I also found another way. If you have arguments @$ in the main section of the script it displays the output without anything special. that's cool..
thanks for all.
Expect is an Open Source tool based on the language Tcl. You can find details on http://expect.nist.gov/