Changeset 425


Ignore:
Timestamp:
Nov 25, 2019, 11:30:33 AM (5 years ago)
Author:
g7moreau
Message:
  • Add delay_yime variable publickly changeable
Location:
trunk/tssh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tssh/config.sample.sh

    r420 r425  
    11# config file ~/.config/tssh/config.sh
    22
     3#export delay_time=0.8
    34#export split_number=16
    45export dyn_domain='mycompagny.local'
  • trunk/tssh/tssh

    r424 r425  
    1111export LANG=C
    1212
    13 VERSION='0.2.1'
     13VERSION='0.2.2'
    1414
    1515function usage() {
     
    1717tssh - tmux cluster ssh
    1818
    19  tssh [-w number] [-f] [-v] [-p] [-c remote_cmd] [-o ssh_option] <host1> <host2> <clusterssh class>... <hostM>- <hostN>+
     19 tssh [-w number] [-f] [-v] [-h] [-p] [-c remote_cmd] [-o ssh_option] <host1> <host2> <clusterssh class>... <hostM>- <hostN>+
    2020
    2121   -w windows     windows to open (integer, default 16)
     
    3131   }
    3232
     33export delay_time=0.8
    3334export remote_command=''
    3435export ssh_option=''
     
    199200
    200201# wait is needed by time tmux session open and ssh time connection
    201 tempo=0.8
    202 first_tempo=0
    203 other_tempo=0
     202first_delay_time=0
     203other_delay_time=0
    204204if [ -n "${remote_command}" ]
    205205then
    206    # add tempo after remote command
    207    other_tempo=${tempo}
    208    first_tempo="${tempo} ${other_tempo}"
     206   # add delay time after remote command
     207   other_delay_time=${delay_time}
     208   first_delay_time="${delay_time} ${other_delay_time}"
    209209fi
    210210
     
    223223   IFS=$'\n' host=($(cat "/tmp/${base_path}/${f}"))
    224224
    225    tmux -2 new-session -d -s $session "ssh ${ssh_option} ${host[0]} ${remote_command}; sleep ${first_tempo}"
    226    # wait ${tempo} second to let new session start...
    227    sleep ${tempo}
     225   tmux -2 new-session -d -s $session "ssh ${ssh_option} ${host[0]} ${remote_command}; sleep ${first_delay_time}"
     226   # wait ${delay_time} second to let new session start...
     227   sleep ${delay_time}
    228228
    229229   for (( i=1 ; i < ${#host[@]} ; i++))
    230230   do
    231       # wait ${tempo} needed in case of ${remote_command}
    232       tmux splitw -t $session "ssh ${ssh_option} ${host[$i]} ${remote_command}; sleep ${other_tempo}"
     231      # wait ${delay_time} needed in case of ${remote_command}
     232      tmux splitw -t $session "ssh ${ssh_option} ${host[$i]} ${remote_command}; sleep ${other_delay_time}"
    233233      tmux select-layout tiled
    234234   done
     
    285285=head1 SYNOPSIS
    286286
    287  tssh [-w number] [-f] [-v] [-p] [-c remote_cmd] [-o ssh_option] <host1> <host2> <clusterssh class>... <hostM>- <hostN>+
     287 tssh [-w number] [-f] [-v] [-h] [-p] [-c remote_cmd] [-o ssh_option] <host1> <host2> <clusterssh class>... <hostM>- <hostN>+
    288288
    289289=head1 OPTIONS
     
    371371The C<tssh> config file (F<~/.config/tssh/config.sh>) can be use change the default parameters.
    372372
     373 #export delay_time=0.8
    373374 #export split_number=16
    374375 export dyn_domain='mycompagny.local'
     
    377378 #export verbose='yes'
    378379
     380=head2 C<delay_time>
     381
     382When use with C<tmux>, add a small delay before lauching the second shell to let C<tmux> open the window.
     383
     384
    379385=head1 SEE ALSO
    380386
    381387cluster-ssh, cssh, xargs, parallel, tmux
    382388
     389
    383390=head1 AUTHORS
    384391
    385392Written by Gabriel Moreau, Grenoble - France
     393
    386394
    387395=head1 COPYRIGHT
Note: See TracChangeset for help on using the changeset viewer.