Overview: If you SSH to VMS (with keys configured for no prompting,
etc) on an interactive command line, you can grab the stdout. However,
when you run from cron, you don't get anything on stdout. Details....

I have these scripts on a Linux box...
$ cat unix2unix.sh
#!/bin/bash
(
echo "Running unix2unix.sh @ `date`"
tty
ssh user@unixbox date
echo "return-code=$?"
) >> unix2unix.log 2>&1

$ cat unix2vms.sh
#!/bin/bash
(
echo "Running unix2vms.sh @ `date`"
tty
ssh user@vmsbox show time
echo "return-code=$?"
) >> unix2vms.log 2>&1

When you run these from the command line, you see output like this in
the logs...
$ ./unix2unix.sh
$ cat unix2unix.log
Running unix2unix.sh @ Fri Oct 10 12:01:49 BST 2008
/dev/pts/1
Fri Oct 10 12:01:50 GMTDT 2008
return-code=0

$ ./unix2vms.sh
$ cat unix2vms.log
Running unix2vms.sh @ Fri Oct 10 12:02:02 BST 2008
/dev/pts/1

10-OCT-2008 12:02:03
return-code=255


Fine so far. We have a tty, and get output from both scripts. Here's
the PROBLEM (thanks for reading this far), when you run the above
lines from cron, you don't get the output from VMS, but you do from
UNIX (tried this with Solaris, Linux & Cygwin on Windows!).

So, cronjobs are...
$ rm *.log (let's start again)
$ crontab -l
* * * * * ./unix2unix.sh >> unix2unix.log 2>&1
* * * * * ./unix2vms.sh >> unix2vms.log 2>&1

The output from the logs looks like this...
$ tail -100f *.log
==> unix2unix.log <==
Running unix2unix.sh @ Fri Oct 10 12:00:01 BST 2008
not a tty
Fri Oct 10 12:00:01 GMTDT 2008
return-code=0

==> unix2vms.log <==
Running unix2vms.sh @ Fri Oct 10 12:00:01 BST 2008
not a tty
return-code=255



So, even though we don't have a tty in both situations, we DO get
output from the remote Unix box, but NOT from VMS. The return-code
doesn't change in either situation. Has anyone out there seen this
problem before? If so, any ideas on how to get round/fix this issue?

FYI, I've tried various ways of doing this:
- setting SSH_TTY environment to 'fool' a tty id (I know, but I'm
desperate)
- using -t (to force tty). You just get output like this in the
logs....

$ tail -100f *.log
==> unix2unix.log <==
Running unix2unix.sh @ Fri Oct 10 11:53:01 BST 2008
not a tty
Pseudo-terminal will not be allocated because stdin is not a terminal.
Fri Oct 10 11:53:01 GMTDT 2008

==> unix2vms.log <==
Running unix2vms.sh @ Fri Oct 10 11:53:01 BST 2008
not a tty
Pseudo-terminal will not be allocated because stdin is not a terminal.


Basically, VMS seems to need the caller to have a tty. Any ideas on
how to get round this when calling from cron..?
Many thanks!