I am new to UNIX scripting . I have script (ex: start_script) that starts a job in 10 different servers one server after another.Now I want to modify the script so that the script starts the job in all servers parallely (at a time in all servers).and I need the choice of selecting the servers.How can this be made possible.
Assumptions are never good, but you've given little to go on, so Im assuming:
1) Ksh or maybe bash
2) you'll start the remote 'jobs' with ssh
3) the list of remote hosts is in some file, maybe with the command to execute on that particular host
#!/usr/bin/env ksh
# this is completely untested!!!
while read host command
do
echo "$(date) starting on $host: $command"
ssh -n $host "$command" >/tmp/log/foo.$host 2>&1 &
done <job-list-file
wait
echo "$(date) all remote jobs finished"
The job file contains the host names followed by the exact command you'd like to run on that host.