Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 727103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:31:46+00:00 2026-05-14T06:31:46+00:00

I have a few simple scripts that are intended to daisy chain together to

  • 0

I have a few simple scripts that are intended to daisy chain together to run a specific script on a set of servers all listed out in a file, one per line.

The single server deploy script contains the following:

  1 #!/bin/bash
  2 
  3 file=$1
  4 host=$2
  5 
  6 scp ${file} ${host}:/tmp/
  7 USER=`whoami`
  8 ssh -t -t $USER@${host} /tmp/${file}
  9 
 10 ssh "${host}" /bin/rm /tmp/${file}
 11 exit

It works fine on a script I have that yum installs tomcat and symlinks hadoop/hbase configs to the shared class directory.

The second major file is deploy-all.sh which is intended to parse a list of hosts and run the deploy script to all of them:

  1 #!/bin/bash
  2 
  3 script=$1
  4 
  5 cat dumbo-hosts | while read fileline
  6 do
  7 echo ${fileline}
  8 ./deploy.sh ${script} ${fileline}
  9 
 10 sleep 10
 11 done

What happens is that the script runs once, and then the for loop is broken… I got something like the following output:

$ ./deploy-all.sh setup-tomcat.sh 
line is hadoop01.myhost
setup-tomcat.sh                               100%  455     0.4KB/s   00:00    
tcgetattr: Inappropriate ioctl for device
hadoop02.myhost
hadoop03.myhost
hadoop04.myhost
<succesful output of hadoop01 task>
...
Connection to hadoop01.myhost closed.

If I comment out the ssh commands the loop runs succesfully through all 4 hosts so I presume it’s something involving stdio getting cut off once the ssh occurs. In addition the tcgatattr error concerns me somewhat.

How can I get around this? What exactly is causing the tcgetattr error(I’m not even sure if it’s related)?
Haven’t really done much with shell scripts so sorry if I’m missing something really obvious here, any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:31:46+00:00Added an answer on May 14, 2026 at 6:31 am

    It’s a problem with ssh reusing the stdin file descriptor when running as part of the subprocess.

    The workaround is to use ‘-n’ when invoking ssh from a non-terminal context.

    option=-n
    tty -s 2>/dev/null && option=
    
    scp ${file} ${host}:/tmp/
    ssh $option -t ${host} /tmp/${file}
    ssh $option ${host} rm /tmp/${file}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I have a few scripts that run as part of my build process
I have a few simple php scripts that I am writing for a website
I have written a small makefile for a few simple C programs that compiles
I have a simple C++ DLL that implements a few custom actions for a
I have simple win service, that executes few tasks periodically. How should I pass
I have set up a few models in a simple django project. When I
I have a fairly simple python loop that calls a few functions, and writes
I've created a really simple bash script that runs a few commands. one of
I have quite a few simple functions that I had previously kept in my
Pretty simple question. I have a few ASP RequiredFieldValdators checking some text boxes. Out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.