[ Level 2 ] Connect pool for ssh.
If you want to use the concept "connection pool" for ssh, you could try the following sample. #!/bin/bash # # You might need to modify sshd_config with the following attributes: # # MaxStartup 200 # MaxSessions 200 # [ "$1" == "-d" ] && set -vx && shift control_master="$1" && [ "$control_master" != "false" ] && control_master=true username="$2" && [ -z $username ] && username=stanley remote_host="$3" && [ -z $remote_host ] && remote_host=127.0.0.1 cmd1="$4"&& [ -z $cmd1 ] && cmd1=ls control_master_option="" client_cmd="/tmp/a.sh" buildControlMaster() { if $control_master then ssh -N -o "ControlMaster auto" -o "ControlPath ~/.ssh/master-$username@$remote_host" $username@$remote_host & fi } createClientCmd() { mkdir -p /tmp/add rm /tmp/add/* $client_cmd if $c...