This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

STDOUT of non cygwin command lost (in automated ssh session)


background (why plink is used):

  We have a wrapper script that runs plink to start a localhost ssh
  session w/password authentication. This wrapper script is designed to
  run a command after the ssh login. (We also have a similar cygwin expect
  script.) The benefit- network drives are writable. These wrapper scripts
  are used in crontabs. The problem is not with these scripts 

problem:

  plink starts a local ssh session using password authentication just
  fine, and then passes in a command to run: "cmd /c bar.bat".  Inside
  bar.bat are lines: "echo hi" and "netstat -n". The output of
  "netstat -n" is lost.  (real problem is w/a command other than netstat.)

failing test case, 20051214 snapshot: (output from netstat command is lost)

  ~ $ uname -a
  CYGWIN_NT-5.0 c7mkes108 1.5.19s(0.148/4/2) 20051214 14:58:27 i686 unknown unknown Cygwin
  ~ $ plink -l scmcron -ssh -pw 'MYPASSWORDHERE' localhost 'export PATH="/bin:/usr/bin:$PATH";cd /tmp;set -x;cat bar.bat;cmd /c bar.bat' #end of plink command (sorry for long line)
  + cat bar.bat
  echo hi
  netstat -n
  + cmd /c bar.bat

  c:\aut\cyg\tmp>echo hi
  hi

  c:\aut\cyg\tmp>netstat -n
  ~ $ date # NEXT I TRY ADDING the -wait switch below:
  Sat Dec 17 11:13:07 CST 2005
  ~ $ plink -l scmcron -ssh -pw 'MYPASSWORDHERE' localhost 'export PATH="/bin:/usr/bin:$PATH";cd /tmp;set -x;cat bar.bat;cmd -wait /c bar.bat'
  + cat bar.bat
  echo hi
  netstat -n
  + cmd -wait /c bar.bat

  c:\aut\cyg\tmp>echo hi
  hi

  c:\aut\cyg\tmp>netstat -n
  ~ $ # no joy

working 20051029 snapshot:

  ~ $ uname -a
  CYGWIN_NT-5.0 c7mkes108 1.5.19s(0.141/4/2) 20051029 16:39:28 i686 unknown unknown Cygwin
  ~ $ plink -l scmcron -ssh -pw 'MYPASSWORDHERE' localhost 'export PATH="/bin:/usr/bin:$PATH";cd /tmp;set -x;cat bar.bat;cmd -wait /c bar.bat' #end of plink command (sorry for long line)
  + cat bar.bat
  echo hi
  netstat -n
  + cmd -wait /c bar.bat

  c:\aut\cyg\tmp>echo hi
  hi

  c:\aut\cyg\tmp>netstat -n

  Active Connections

    Proto  Local Address          Foreign Address        State
    TCP    10.125.15.180:22        10.222.10.182:46863   ESTABLISHED
    TCP    10.125.15.180:445       10.125.15.191:3843      ESTABLISHED
    TCP    10.125.15.180:445       10.125.15.192:2682      ESTABLISHED
    TCP    10.125.15.180:1098      10.125.15.180:5413      ESTABLISHED
    TCP    10.125.15.180:1104      10.125.15.180:5413      ESTABLISHED
    TCP    10.125.15.180:1106      10.125.15.180:1339      ESTABLISHED
    TCP    10.125.15.180:1106      10.125.15.180:1343      ESTABLISHED
    TCP    10.125.15.180:1106      10.125.15.180:1367      ESTABLISHED
  --snip (it also works w/out the "-wait")

--
Tom Rodman

--

Attachment: cygcheck.out
Description: cygcheck -s -v -r

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]