Skip to content

Instantly share code, notes, and snippets.

@FedericoCeratto
Forked from olvesh/ssh-multi.sh
Last active December 31, 2015 20:49
Show Gist options
  • Select an option

  • Save FedericoCeratto/8042933 to your computer and use it in GitHub Desktop.

Select an option

Save FedericoCeratto/8042933 to your computer and use it in GitHub Desktop.

Revisions

  1. FedericoCeratto revised this gist Dec 19, 2013. 1 changed file with 2 additions and 13 deletions.
    15 changes: 2 additions & 13 deletions ssh-multi.sh
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,12 @@
    #!/bin/bash
    # ssh-multi
    # D.Kovalov
    # Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html

    # a script to ssh multiple servers over multiple tmux panes


    starttmux() {
    if [ -z "$HOSTS" ]; then
    echo -n "Please provide of list of hosts separated by spaces [ENTER]: "
    read HOSTS
    fi

    local hosts=( $HOSTS )

    multimux() {

    readarray hosts < "$1"
    tmux new-window "ssh $1@${hosts[0]}"
    unset hosts[0];
    for i in "${hosts[@]}"; do
    @@ -26,6 +18,3 @@ starttmux() {

    }

    HOSTS=${HOSTS:=$*}

    starttmux
  2. @olvesh olvesh revised this gist Dec 6, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ssh-multi.sh
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    # a script to ssh multiple servers over multiple tmux panes


    starttmux(user) {
    starttmux() {
    if [ -z "$HOSTS" ]; then
    echo -n "Please provide of list of hosts separated by spaces [ENTER]: "
    read HOSTS
    @@ -15,7 +15,7 @@ starttmux(user) {
    local hosts=( $HOSTS )


    tmux new-window "ssh ${user}@${hosts[0]}"
    tmux new-window "ssh $1@${hosts[0]}"
    unset hosts[0];
    for i in "${hosts[@]}"; do
    tmux split-window -h "ssh $i"
  3. @olvesh olvesh revised this gist Dec 6, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ssh-multi.sh
    Original file line number Diff line number Diff line change
    @@ -6,16 +6,16 @@
    # a script to ssh multiple servers over multiple tmux panes


    starttmux() {
    starttmux(user) {
    if [ -z "$HOSTS" ]; then
    echo -n "Please provide of list of hosts separated by spaces [ENTER]: "
    read HOSTS
    fi

    local hosts=( $HOSTS )


    tmux new-window "ssh ${hosts[0]}"
    tmux new-window "ssh ${user}@${hosts[0]}"
    unset hosts[0];
    for i in "${hosts[@]}"; do
    tmux split-window -h "ssh $i"
  4. @dmytro dmytro created this gist Oct 31, 2012.
    31 changes: 31 additions & 0 deletions ssh-multi.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    #!/bin/bash
    # ssh-multi
    # D.Kovalov
    # Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html

    # a script to ssh multiple servers over multiple tmux panes


    starttmux() {
    if [ -z "$HOSTS" ]; then
    echo -n "Please provide of list of hosts separated by spaces [ENTER]: "
    read HOSTS
    fi

    local hosts=( $HOSTS )


    tmux new-window "ssh ${hosts[0]}"
    unset hosts[0];
    for i in "${hosts[@]}"; do
    tmux split-window -h "ssh $i"
    tmux select-layout tiled > /dev/null
    done
    tmux select-pane -t 0
    tmux set-window-option synchronize-panes on > /dev/null

    }

    HOSTS=${HOSTS:=$*}

    starttmux