Run a shell script on all 15 servers at the same time?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Run a shell script on all 15 servers at the same time?
# 8  
Old 09-10-2015
Do you mean avoiding the SSH passphrase when you open the connection? You would need to create a key-pair that does not have one. You then have to carefully consider if anything or anyone else could get at the private key, because without a passphrase, it could be used more easily.

Can you secure the account that will be performing this work?


Robin
This User Gave Thanks to rbatte1 For This Post:
# 9  
Old 09-10-2015
Quote:
Originally Posted by laknar
Code:
textfile="/home/laknar/hostfile"

while read r
do
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no laknar@$r 'myscript.ksh &'

done < $textfile

is this correct?
You should prevent ssh from reading the while loop's input.
Either by redirecting ssh's stdin
Code:
  < /dev/null ssh ...

or by a -n option
Code:
  ssh -n ...

If the backgrounding works, it is safer to add a little sleep to the loop
Code:
while ...
do
   command &
   sleep 1
done

# 10  
Old 09-10-2015
After enter passphrase , i am able to do ssha directly to the host but not from the script..
# 11  
Old 09-10-2015
Hi.

For the parallel connection to numerous servers, we use:
Code:
pdsh - Efficient rsh-like utility, for using hosts in parallel

with the ssh (not rsh) option after the keys have been distributed to the servers.

There may be other even better solutions, but pdsh has worked well for us. It seems to be on most Linux variants.

Best wishes ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell Script to run in given time

Hi All, Would like to write a Script which will run between 11am to 3 pm and send the results to output.txt. Please suggest. (2 Replies)
Discussion started by: vasuvv
2 Replies

2. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

3. Shell Programming and Scripting

Run a script on multiple servers

I need to run a script on a bunch of remote servers. how can this be done without ssh into each individual server and run it its under /sbin/script.sh on each server (1 Reply)
Discussion started by: tdubb123
1 Replies

4. Shell Programming and Scripting

How to give password at run time in a shell script?

hi, how can i pass a password automatically when a shell script is running. i have shell script(runscript.sh) which call another shell script inside it as a different user. runscript.sh contains su - nemo -c "/bin/main_script.sh" but when i execute "runscript.sh" it try to run... (7 Replies)
Discussion started by: Little
7 Replies

5. Shell Programming and Scripting

Run a script in parts on 2 servers

Hi all, I have a task for which I need to run some commands on one server1 and then jump from the server1 (using ssh and asking user to enter login credentials manually for server2 server) to server2 and run some commands there and exit. I know the script I need here but problem is when I... (5 Replies)
Discussion started by: pat_pramod
5 Replies

6. Shell Programming and Scripting

run vi/vim encrypted shell script without decryption on multiple servers

Hello Everyone, How do we run vi/vim encrypted shell script without decryption on multiple servers. It is a simple bash script and vim -nx <filename> has been used to encrypt with desired password. Now I have few errors, the syntax is absolutely fine as I have run that script multiple times on... (0 Replies)
Discussion started by: lovesaikrishna
0 Replies

7. Shell Programming and Scripting

Connect Oracle using shell script at run time

Hi all, I am a newbie.....am jus trying to connect to oracle thro a script, but not thro giving the username/password@server_name directly like `$ORACLE_HOME/bin/sqlplus username/password@server_name In the above line, once it is connected to Oracle, it shud ask me the username and password... (4 Replies)
Discussion started by: kritibalu
4 Replies

8. Shell Programming and Scripting

Shell script to find the run time based on log entries?

Shell script to find the run time based on log entries? Below is the log files content updated when the script test.sh runs. I would like to calculte the difference between first update time stamp and last update time stamp to find the run time of the script. The below log file shows the first... (1 Reply)
Discussion started by: mailtopranesh
1 Replies

9. Shell Programming and Scripting

How to stop monitoring of servers at the time of reboot through shell scripting?

We have number of servers which belongs to platforms Solaris, AIX,HP-UX and LINUX. Monitoring tool 'Patrol Agent' process run on the servers to check for the server health and communicate with the Patrol server through the port 5181. During scheduled reboot and maintenance of servers we do receive... (1 Reply)
Discussion started by: subharai
1 Replies

10. Shell Programming and Scripting

How to run same script on multiples servers

Hi All, I have some script that run some commands and send results to my email. I want to run same script on mulitiple servers. How can I do that. I know there is an option "ssh". But I'm not quite sure how to use it in the script. And also. scripts has some parameters like following, if :... (10 Replies)
Discussion started by: s_linux
10 Replies
Login or Register to Ask a Question