- Timestamp:
- Nov 24, 2019, 5:40:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tssh/tssh
r392 r416 21 21 22 22 OPTIONS 23 -w 23 -w windows windows to open (integer, default 16) 24 24 -o ssh_option option to pass to ssh 25 25 -f fast, no nmap scan to eliminate sleeping computer 26 26 -v verbose 27 27 -c remote_cmd launch the remote command on hosts and exit 28 -p launch in parallel (only with -c) with command parallel or xargs 28 29 -h help 29 30 … … 120 121 # get options 121 122 if [ $# -eq 0 ]; then usage; exit 1; fi 122 while getopts "w:o:c:fv h" options123 while getopts "w:o:c:fvph" options 123 124 do 124 125 case ${options} in … … 139 140 usage 140 141 exit 2 141 fi 142 fi 143 ;; 144 p) 145 export parallel='yes' 142 146 ;; 143 147 o) … … 246 250 done 247 251 252 if [ "${parallel}" == 'yes' -a -n "${remote_command}" ] 253 then 254 if which parallel > /dev/null 255 then 256 sort -u "/tmp/${base_path}/master++" | parallel -j ${split_number} "ssh ${ssh_option} {} ${remote_command}" 257 else 258 sort -u "/tmp/${base_path}/master++" | xargs -n 1 -P ${split_number} -I{} ssh ${ssh_option} {} "${remote_command}" 259 fi 260 261 # Clean temporary folder 262 [ -d "/tmp/${base_path}" ] && rm -rf "/tmp/${base_path}" 263 264 exit 0 265 fi 266 267 248 268 # split master list in paquet of split_number computer 249 269 sort -u "/tmp/${base_path}/master++" | split -l ${split_number} - /tmp/${base_path}/__splitted_
Note: See TracChangeset
for help on using the changeset viewer.