Sponsored Content
Top Forums Shell Programming and Scripting Require single command to start script in multiple servers Post 302749777 by mirwasim on Saturday 29th of December 2012 12:30:37 PM
Old 12-29-2012
Hello.

Code:
#!/bin/sh
for sv in $1  # and so on
do
     ssh $sv '/export/home/pin/pin/bin/healthcheck_ONDB.ksh'
done

It did send command to server and script execute also but the functionality script does, it did do any of them..i killed that script.. it even didnt write the txt file also

---------- Post updated at 10:55 PM ---------- Previous update was at 10:42 PM ----------

And how to check ssh is enabled and ssh keys are distributed..

indeed script got triggered but it did not perform functionality.
and i killed it..

---------- Post updated at 11:00 PM ---------- Previous update was at 10:55 PM ----------

if u talking about public key, private key, then yes its on all hosts
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to run multiple command in single command?

Dear Unix Guru, I have several directories as below /home/user/ dir1 dir2 dir3 Each directory has different size. I want to print each directory size (Solaris command du -hs .) Can you please guide me how to achieve this? Thanks Bala (2 Replies)
Discussion started by: baluchen
2 Replies

2. Shell Programming and Scripting

Shell/perl script to connect to different servers in single login in teradata

Hi, I want to write a shell script to compare two tables in teradata.these tables are present on different servers. I want to connect to both servers in single login in order to fetch and compare the data in one go. Thanks (1 Reply)
Discussion started by: monika
1 Replies

3. UNIX for Advanced & Expert Users

ssh: require passphrase from some servers but not others

We have a number of linux clusters running Oracle. The clusters require that all member nodes have promptless/passwordless login through ssh (ie. the keys were created with null passphrases). We also have a management server that is not a member of any cluster but routinely connects to nodes of all... (3 Replies)
Discussion started by: Squeakygoose
3 Replies

4. SuSE

Regarding accessing multiple servers using single public ip address

Hello, Currently we are having different linux servers (for example: let's assume audio server, video server and text server) to handle requests from outside users. Suppose the outside users in different LAN (Local Area Network), other than the servers. For example user is in 20 series LAN and... (5 Replies)
Discussion started by: navneet_2009
5 Replies

5. HP-UX

Automatic execution of commands in multiple servers using single script.

Hi, I've to do a simple job many times whenever it has been asked, just i've to log in to all of fourtien HP servers and i've to execute ps -fu user > temp cat temp|sendmail "xyz@z.com" commands to send the statics of all of 14 servers over the mail to particular user id.. Though logging... (4 Replies)
Discussion started by: vickramshetty
4 Replies

6. UNIX for Dummies Questions & Answers

Grep multiple strings in multiple files using single command

Hi, I will use below command for grep single string ("osuser" is search string) ex: find . -type f | xarg grep -il osuser but i have one more string "v$session" here i want to grep in which file these two strings are present. any help is appreciated, Thanks in advance. Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies

7. Programming

Would you please give me some idea about single client and multiple servers

Hi, I have a program which needs to connect multiple servers at the same time. The program has to collect data from each of servers and then make a decision regarding to the data received. There are several requirements. 1. Server (s) may shutdown anytime without any ack (e.g.power... (1 Reply)
Discussion started by: sehang
1 Replies

8. Shell Programming and Scripting

Script to execute command to get info from multiple servers

Hi, I want to collect info from a no. of servers whether there grub.conf contain "elevator" parameter or not. What I want is sudo cat /etc/grub.conf | grep -q "elevator=noop"; echo $? If output is "0", I want name of that host in a file called "present" if its not "0", I want that... (4 Replies)
Discussion started by: stunn3r
4 Replies

9. Shell Programming and Scripting

Logging in to multiple Linux servers and running the command.

Hi, I am trying to write a script to run a command on multiple linux based servers and get the o/p. I am using ssh to login. It is a celerra box and EMC NAS product. I am able login but i am not able to run nas command nas_pool -size -all the NAS server. I am getting the following error. ... (2 Replies)
Discussion started by: jpkumar10
2 Replies

10. Shell Programming and Scripting

How to run simple single command on multiple Linux servers?

Hi All, How can i run a single command on multiple servers with or without giving credentials. I have a file(servers.txt) which has got list of servers and i want to run a command lsb_release -dr on all these servers and get output of those servers against each server. I tried below code... (9 Replies)
Discussion started by: darling
9 Replies
SSH-COPY-ID(1)						    BSD General Commands Manual 					    SSH-COPY-ID(1)

NAME
ssh-copy-id -- use locally available keys to authorise logins on a remote machine SYNOPSIS
ssh-copy-id [-n] [-i [identity_file]] [-p port] [-o ssh_option] [user@]hostname ssh-copy-id -h | -? DESCRIPTION
ssh-copy-id is a script that uses ssh(1) to log into a remote machine (presumably using a login password, so password authentication should be enabled, unless you've done some clever use of multiple identities). It assembles a list of one or more fingerprints (as described below) and tries to log in with each key, to see if any of them are already installed (of course, if you are not using ssh-agent(1) this may result in you being repeatedly prompted for pass-phrases). It then assembles a list of those that failed to log in, and using ssh, enables logins with those keys on the remote server. By default it adds the keys by appending them to the remote user's ~/.ssh/authorized_keys (creating the file, and directory, if necessary). It is also capable of detecting if the remote system is a NetScreen, and using its 'set ssh pka-dsa key ...' command instead. The options are as follows: -i identity_file Use only the key(s) contained in identity_file (rather than looking for identities via ssh-add(1) or in the default_ID_file). If the filename does not end in .pub this is added. If the filename is omitted, the default_ID_file is used. Note that this can be used to ensure that the keys copied have the comment one prefers and/or extra options applied, by ensuring that the key file has these set as preferred before the copy is attempted. -n do a dry-run. Instead of installing keys on the remote system simply prints the key(s) that would have been installed. -h, -? Print Usage summary -p port, -o ssh_option These two options are simply passed through untouched, along with their argument, to allow one to set the port or other ssh(1) options, respectively. Rather than specifying these as command line options, it is often better to use (per-host) settings in ssh(1)'s configuration file: ssh_config(5). Default behaviour without -i, is to check if 'ssh-add -L' provides any output, and if so those keys are used. Note that this results in the comment on the key being the filename that was given to ssh-add(1) when the key was loaded into your ssh-agent(1) rather than the comment contained in that file, which is a bit of a shame. Otherwise, if ssh-add(1) provides no keys contents of the default_ID_file will be used. The default_ID_file is the most recent file that matches: ~/.ssh/id*.pub, (excluding those that match ~/.ssh/*-cert.pub) so if you create a key that is not the one you want ssh-copy-id to use, just use touch(1) on your preferred key's .pub file to reinstate it as the most recent. EXAMPLES
If you have already installed keys from one system on a lot of remote hosts, and you then create a new key, on a new client machine, say, it can be difficult to keep track of which systems on which you've installed the new key. One way of dealing with this is to load both the new key and old key(s) into your ssh-agent(1). Load the new key first, without the -c option, then load one or more old keys into the agent, possibly by ssh-ing to the client machine that has that old key, using the -A option to allow agent forwarding: user@newclient$ ssh-add user@newclient$ ssh -A old.client user@oldl$ ssh-add -c ... prompt for pass-phrase ... user@old$ logoff user@newclient$ ssh someserver now, if the new key is installed on the server, you'll be allowed in unprompted, whereas if you only have the old key(s) enabled, you'll be asked for confirmation, which is your cue to log back out and run user@newclient$ ssh-copy-id -i someserver The reason you might want to specify the -i option in this case is to ensure that the comment on the installed key is the one from the .pub file, rather than just the filename that was loaded into you agent. It also ensures that only the id you intended is installed, rather than all the keys that you have in your ssh-agent(1). Of course, you can specify another id, or use the contents of the ssh-agent(1) as you pre- fer. Having mentioned ssh-add(1)'s -c option, you might consider using this whenever using agent forwarding to avoid your key being hijacked, but it is much better to instead use ssh(1)'s ProxyCommand and -W option, to bounce through remote servers while always doing direct end-to-end authentication. This way the middle hop(s) don't get access to your ssh-agent(1). A web search for 'ssh proxycommand nc' should prove enlightening (N.B. the modern approach is to use the -W option, rather than nc(1)). ENVIRONMENT
SSH_COPY_ID_LEGACY If the SSH_COPY_ID_LEGACY environment variable is set, the ssh-copy-id is run in a legacy mode. In this mode, the ssh-copy-id doesn't check an existence of a private key and doesn't do remote checks of the remote server versions or if public keys are already installed. SEE ALSO
ssh(1), ssh-agent(1), sshd(8) BSD
June 17, 2010 BSD
All times are GMT -4. The time now is 02:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy