This is a discussion on Re: Running ssh cmd on cron -- debug2: channel 0: read failed - openssh ; On Wed, Jan 04, 2006 at 01:55:04PM -0800, Joe Park wrote: > I've been trying to run some commands on remote machine over ssh as a > cron job. It works fine if I manually run it on command line ...
On Wed, Jan 04, 2006 at 01:55:04PM -0800, Joe Park wrote:
> I've been trying to run some commands on remote machine over ssh as a
> cron job. It works fine if I manually run it on command line but it
> does not run right if I run it as a cron job. I get 0 exit status which
> is strange. I found "debug2: channel 0: read failed" message when I ran
> it with -vvv options. [...]
You don't happen to have 2 copies of ssh installed in separate paths,
do you? cron's environment is usually a lot more limited that an
interactive shell's so you might be running different ssh binaries...
If it's not that then I'm not sure what's going on but I have a couple
of things you might like to try: run the ssh command in a nohup and
see if it makes a difference, and try redirecting stdin, stdout to/from
/dev/null on both the client and server (separately).
The other thing: try using adding "-t" to the ssh command line to
allocate a pty on the server side (it's a long shot and not a real
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.