After some messing around (trial and error really) i have got it to work. Original problem is below but the resolution was to remove the -n from the ssh_opts variable and place it only on the source side of the ssh command. I had tried various -t -t options as i understand this relates to pseudo terminals but had no joy. The following now works :- ------ ssh_opts="-o ConnectTimeout=15 \ -o BatchMode=yes \ -o StrictHostKeyChecking=no \ -o LogLevel=quiet \ " #-n " ----------- ssh ${ssh_opts} -n 2>> ${err_log} user@${srv} "cat ${source_file}" | ssh ${ssh_opts} ${dest_host} "cat > ${dest_dir}/${srv}.latest.tar" 2>> ${err_log} The -n option prevents reading from standard in and allows ssh to run in the background and not override the shell script process. This is why i assume it is required on the first ssh and needs not to be present on the second. Hope this helps someone. Original request :- ---------------------------------- Guys i'm trying to run an ssh command from within a shell script but am getting an error. It works fine from the shell :- ------ ssh_opts="-o ConnectTimeout=15 \ -o BatchMode=yes \ -o StrictHostKeyChecking=no \ -o LogLevel=quiet \ -n " ----------- ssh ${ssh_opts} 2>> ${err_log} user@${srv} "cat ${source_file}" | ssh ${ssh_opts} "cat > ${dest_dir}/${srv}.latest.tar" 2>> ${err_log} The error i'm getting in my error log is this :- Pseudo-terminal will not be allocated because stdin is not a terminal. ----------------------------- The reason i am doing this type of transfer is i need to get files from one machine to another using a third as a middle man without storing the file on the middle machine. e.g host B initiates an ssh to host A and cats the file through its connection to a third host C. Any help appreciated Cheers _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagers _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Fri Oct 17 07:22:03 2008
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:12 EST