Running Concurrent Bash Scripts and TasksMax Settings

For a long time, I had an Expect script to login network devices, fetch information and put the output together as a Web page. Think of it as a script checking router version, memory etc. It took about 30 seconds to finish checking a single target and would take hours to finish scanning several subnets. Finally I think it is time to parallel these tasks so the whole scan could take the same time as scan only one device (etc. 30 seconds versus hours). And is excited to find out the simple and powerful usage of xargs -P option. Here are man xargs result regarding -P: -P max-procs, --max-procs=max-procs Run up to max-procs processes at a time; the default is 1. If max-procs is 0, xargs will run as many processes as possible at a time. Use the -n option or the -L option with -P; otherwise chances are that only one exec will be done. Put together into my small script: #!/usr/bin/bash echo >/tmp/list subnets="192.168.4...