Capturing backgrounded dbclient command output

Steven Hein ssh at sgi.com
Sat Jul 31 03:10:31 WST 2010


I've been using dropbear-0.52 happily for a long time now, but
today I tried to write a shell script to execute multiple
dbclient commands in parallel (backgrounded), capture
their output, and then display it when all dbclient
commands have finished.    But I can't seem to capture
any output from the dbclient command.

The target platform for this is an embedded platform
running busybox....but I boiled it down to a simple
failing case on my Fedora 12 box    (I built a brand
new dbclient from the 0.52 tarball).


Here's the simple failing case:


#! /bin/sh

(/tmp/dropbear-0.52/dbclient -y -i /tmp/id_rsa_db localhost pwd) > 
/tmp/tout &
wait


When this script completes, there is nothing in /tmp/tout



When I run this script (same case, just using the openssh client instead):

#! /bin/sh

(ssh localhost pwd) > /tmp/tout &
wait


Then I have data in /tmp/out   (the output from the 'pwd' command).




This problem only appears to happen when the dbclient command is run
in the background from within a script.   If I run this command
directly from the shell command prompt:

(/tmp/dropbear-0.52/dbclient -y -i /tmp/id_rsa_db localhost pwd) > 
/tmp/tout &; wait

Then /tmp/tout contains the output of the 'pwd' command.



Has anyone else wrestled with this problem?    Any solutions or pointers?


Thanks!
Steve




More information about the Dropbear mailing list