0

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 192.168.20.13-192.168.20.21

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.

192.168.20.13-192.168.20.21
192.168.20.22-192.168.20.34 192.168.20.42-192.168.20.45

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 192.168.20.13-192.168.20.21 new-rules

./myscript.sh stop all-pair OR

./myscript.sh stop 192.168.20.13-192.168.20.21

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 192.168.20.21 then 192.168.20.13 then 192.168.20.34 and 192.168.20.22 ..... 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....

1 Answer 1

1

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.

pdsh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .