Changeset 417


Ignore:
Timestamp:
Nov 24, 2019, 6:27:42 PM (5 years ago)
Author:
g7moreau
Message:
  • more robust parallel and xargs command
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tssh/tssh

    r416 r417  
    252252if [ "${parallel}" == 'yes' -a -n "${remote_command}" ]
    253253then
    254    if which parallel > /dev/null
     254   if parallel --version 2> /dev/null | grep -q ^'GNU parallel'
    255255   then
    256       sort -u "/tmp/${base_path}/master++" | parallel -j ${split_number} "ssh ${ssh_option} {} ${remote_command}"
     256      sort -u "/tmp/${base_path}/master++" | parallel -j ${split_number} -I {} -- "ssh ${ssh_option} {} ${remote_command}"
    257257   else
    258       sort -u "/tmp/${base_path}/master++" | xargs -n 1 -P ${split_number} -I{} ssh ${ssh_option} {} "${remote_command}"
     258      sort -u "/tmp/${base_path}/master++" | xargs -r -n 1 -P ${split_number} -I {} -- ssh ${ssh_option} {} "${remote_command}"
    259259   fi
    260260
Note: See TracChangeset for help on using the changeset viewer.