Changeset 148


Ignore:
Timestamp:
Jan 1, 2018, 6:29:03 PM (3 years ago)
Author:
g7moreau
Message:
  • Add tempo for remote command
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tssh/tssh

    r147 r148  
    186186sort -u "/tmp/${base_path}/master++" | split -l ${split_number} - /tmp/${base_path}/__splitted_
    187187
     188# wait is needed by time tmux session open and ssh time connection
     189tempo=0.8
     190first_tempo=0
     191other_tempo=0
     192if [ -n "${remote_command}" ]
     193then
     194   # add tempo after remote command
     195   other_tempo=${tempo}
     196   first_tempo=$((${tempo} + ${other_tempo}))
     197fi
     198
    188199# loop on each split windows
    189200for f in $(ls -1 /tmp/${base_path}/ | grep ^__splitted_)
     
    200211   IFS=$'\n' host=($(cat "/tmp/${base_path}/${f}"))
    201212
    202    tmux -2 new-session -d -s $session "ssh ${host[0]} ${remote_command}"
    203    # wait 1s to let new session start...
    204    sleep 1
     213   tmux -2 new-session -d -s $session "ssh ${host[0]} ${remote_command}; sleep ${first_tempo}"
     214   # wait ${tempo} second to let new session start...
     215   sleep ${tempo}
    205216
    206217   for (( i=1 ; i < ${#host[@]} ; i++))
    207218   do
    208       tmux splitw -t $session "ssh ${host[$i]} ${remote_command}"
     219      # wait ${tempo} needed in case of ${remote_command}
     220      tmux splitw -t $session "ssh ${host[$i]} ${remote_command}; sleep ${other_tempo}"
    209221      tmux select-layout tiled
    210222   done
Note: See TracChangeset for help on using the changeset viewer.