Please read carefully problem first and then give solution...................

we are having 3 files in directory

  1. myscript.sh (the myscript.sh file contain many function and starts/stop to all-pair/single-pair from serverlist.txt file ,the functions like

for start() function: its check whether arg2 is all-pair or single-IP pair then start it.

for stop() function: its check whether arg2 is all-pair or single-IP pair then stop it .

for rules()function: its check whether arg3 is new-rules or same-rules then copy on it

for put_files()function: it uses with arg2 and its check whether arg2 is all-pair or single-IP pair

like:  ./myscript.sh put_files all-pair
or ./myscript.sh put_files

2. deployment_function file: the deploymet_function file fetch IP-Pair from the server_list.txt file in the form of PAIR.

  1. server_list.txt

the server_list.txt conatin hosts ip in the form of IP-Pair (C++ Server- Database server) like this.

Basic syntax of my script:

./myscript.sh arg1 arg2 arg3

where, arg1=start or stop or put-files

arg2=all-pair or single ip pair

arg3=new-rules or same-rules

We are executing our script in the following ways.....

./myscript.sh start all-pair new-rules OR

./myscript.sh start new-rules

./myscript.sh stop all-pair OR

./myscript.sh stop

Problem: Actually, its executing fine but it takes more time to execute on all the IP-pairs because its execute serially. first it goes to then then and ..... when its getting error the its stop on that server. and not execute further on the rest IP-pair.

I want to execute myscript on all the server parallely and if getting error then list out that server and execute furtur. so is there any solution where i can execute same script parallelly without change in myscript . so please help me to find out the proper way to do this....


You can try to use pdsh (Parallel Distributed Shell). Pdsh is a an efficient, multithreaded remote shell client which executes commands on multiple remote hosts in parallel. While it hasn't been updated in quite some time, it still works great when I run scripts across 700 machines.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.