Because xargs stops working if a process exits with an error I've wrote this small script. It takes a command and launches it with each parameter provided in the --params argument.
#!/usr/bin/env python3
import argparse
from concurrent import futures
from concurrent.futures import ThreadPoolExecutor
import subprocess
parser = argparse.ArgumentParser(description='Stress test a FTP server')
parser.add_argument('-t', '--t', type=int, dest="threads", default=2, help="Number of threads to launch")
parser.add_argument('-c', '--command', dest="command", help="The command to be executed by the threads", required=True)
parser.add_argument('-p', '--parameters', dest="params", nargs='*', help="List of parameters", required=True)
args = parser.parse_args()
numErrExit = 0
jobs = []
with ThreadPoolExecutor(max_workers=args.threads) as executor:
for param in args.params:
job_args = [args.command, param]
jobs = [executor.submit(subprocess.call, job_args)]
for job in futures.as_completed(jobs):
if job.result() != 0:
numErrExit += 1
print("Commands:", len(args.params), "- Non-zero:", numErrExit)