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 8970585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:44:47+00:00 2026-06-15T17:44:47+00:00

I have setup a few EC2 instances, which all have a script in the

  • 0

I have setup a few EC2 instances, which all have a script in the home directory. I would like to run the script simultaneously across each EC2 instance, i.e. without going through a loop.

I have seen csshX for OSX for terminal interactive useage…but was wondering what the commandline code is to execute commands like

ssh user@ip.address . test.sh

to run the test.sh script across all instances since…

csshX user@ip.address.1 user@ip.address.2 user@ip.address.3 . test.sh 

does not work…

I would like to do this over the commandline as I would like to automate this process by adding it into a shell script.

and for bonus points…if there is a way to send a message back to the machine sending the command that it has completed running the script that would be fantastic.

  • 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-06-15T17:44:48+00:00Added an answer on June 15, 2026 at 5:44 pm

    will it be good enough to have a master shell script that runs all these things in the background? e.g.,

    #!/bin/sh
    pidlist="ignorethis"
    for ip in ip1 ip2
    do
        ssh user@$ip . test.sh &
        pidlist="$pidlist $!" # get the process number of the last forked process
    done
    
    # Now all processes are running on the remote machines, and we want to know
    # when they are done.
    
    # (EDIT) It's probably better to use the 'wait' shell built-in; that's
    # precisely what it seems to be for.
    while true
    do
        sleep 1
        alldead=true
        for pid in $pidlist
        do
            if kill -0 $pid > /dev/null 2>&1
            then
                alldead=false
                echo some processes alive
                break
            fi
        done
        if $alldead
        then
            break
        fi
    done
    

    echo all done.

    it will not be exactly simultaneous, but it should kick off the remote scripts in parallel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup BPS and have created a few BPEL processes which i can
I have setup two timers in my application which both repeats every a few
I have wamp setup with quite a few websites setup as virtual hosts like
I have setup AzMan and have a few classic ASP sites that I would
I have few sites, and they all have identical setup on a single server.
I have a few Windows Services written in C# that I have setup to
I have setup the basic LAMP server on Ubuntu 11.10 and had a few
As I have to setup quite a few Windows Server machines, I decided to
I am trying to setup a few fixes in some code that have caught
I am trying to setup a tsung cluster on two ec2 instances: Master -

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.