ssh batch troubles

Howard Lowndes lannet at
Wed Dec 11 21:38:36 EST 2002

On Wed, 11 Dec 2002, Damien Elmes wrote:

> Howard Lowndes <lannet at> writes:
> > I am having problems running ssh in a batch job, specifically a cron
> > script.  I am trying to pass a command to another box using ssh.
> >
> > I have tried the -n and -o "BatchMode yes" options to ssh but the job
> > hangs just before it is due to close.
> >
> > Running the script from the command line works OK.
> >
> > Any clues?
> Hangs? Try hit: [RET] ~ .
> If it terminates fine there, then the command is probably opening standard
> output/error and forking to the background. SSH keeps the connection open
> incase there's any future output. Try redirecting it to /dev/null instead.

I've tried redirecting stdin to </dev/null and to <&-  but neither make
any difference.

I'm wondering if it's something on the remote box's sshd as that was
recently upgraded and sshd might be broken when a local cron script tries
to run ssh to send a command to the remote box; it just doesn't seem to
send enough back to the local box to tell it to close the ssh connection.
The difficulty is that ssh works fine from the command line.

LANNet Computing Associates - Your Linux people
Contact detail at
"Flatter government, not fatter government." - me
 Get rid of the Australian states.
If electricity comes from electrons, does morality come from morons?

More information about the linux mailing list