The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 11-20-2007
edcrosbys edcrosbys is offline
Read Only
  
 

Join Date: Jul 2007
Posts: 15
Quote:
Originally Posted by Lakris View Post
I think that since ssh is non-interactive (not a controlling terminal) You can't have a terminal like session, either You must work with something like expect or keep the script locally and just "collect" whatever info
X100!!!

I've had this bite me before with some programs that want a terminal to send data too... Root get's email garbage then.

Quote:
And in general, is there a rule that I should keep in mind when executing a test condition in a remote machine thru a SSH script ?
Act like there is nowhere for it to read info from except local system variables, files and program output. I would usually use a script like this to cycle between many boxes If I want to interact with the script, I have my box do the control while the remote does the data gathering.

Like this:

ssh user@ubuntu "ls -l /test"
echo "Continue counting files starting with a`s ?"
read answer
if [ "$answer" = y ]
then
ssh user@ubuntu "ls -l a*"
fi

It's not as efficient with multple sign-ons, but the logic is all local. The only exception is if there is large amounts of data to filter out (with a grep or something) - I'll try and be nice to the network.