Sponsored Content
Top Forums Shell Programming and Scripting Script to ssh to different server and get some info Post 302163464 by ennstate on Friday 1st of February 2008 04:23:33 AM
Old 02-01-2008
Quote:
Originally Posted by am_yadav
Hi Friends,

i am trying to write a script on server MACHINE1 to ssh to server MACHINE2 and fetch some information.

i am using the following command:

ChanCount=`ssh MACHINE2 "disp card all | grep Inserv | grep -v STATE | wc -l"`

The "disp" command works well on MACHINE2 but not working through this command and the output says "disp not found".

Please suggest the workaround.

Thanks,
Am
May be the "disp" command is not present or cannot be located in any of the directories listed in the PATH variable on the MACHINE2,if know under which directory its located use full path to the command.

Thanks
Nagarajan G
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automated script to SSH to another server

Hi guys, I have a script which looks a little like this; grep $id /usr/local/production/service/distributor/clients/*/out/events.xml | awk -F/ '{print $8}' I want to be able to run this on my dev box, so need to add something into the script which will SSH onto the live server, collect the... (2 Replies)
Discussion started by: JayC89
2 Replies

2. Shell Programming and Scripting

shell script for how to connect to a remote server by using ssh

i want to connect to a remote server through ssh. i have to also provide password within that script. after connecting to the remote server i want to do some operations like grep,cd etc can u pls help me to wite a script. Thanks (1 Reply)
Discussion started by: millan
1 Replies

3. Shell Programming and Scripting

Running a function on a remote server via SSH in a script

I'm working on a script (mostly for practice) to simplify a task I have to do every now and then. I have a cluster with 6 servers on it, each server has a directory with a set of files called *.pid and *.mpid. Each file contains the pid of a process that may or may not be running on that server.... (3 Replies)
Discussion started by: DeCoTwc
3 Replies

4. Shell Programming and Scripting

Run shell script on another server using ssh

Hi, I have 2 servers and i installed ssh2 on both boxes .. so they they can communicate with each other with our password auth .. now i want to write a scrip on box 1 for running commands and getting out put from the second box can some one help me out Thank you in advance (1 Reply)
Discussion started by: anwesh
1 Replies

5. Shell Programming and Scripting

how to supply arguments for a script while ssh to a server

Hi, I have something like below code piece in ksh while read machine do ssh $user@$machine < steps.ksh $RPI done < $machine here, after it gets logged in to server it is not considering the $PRI as argument for steps.ksh script please suggest the fix. (1 Reply)
Discussion started by: rbalaj16
1 Replies

6. Shell Programming and Scripting

ksh script with Interactive ssh on remote server

HI Unix Gurus, I an stuck in an interesting issue, where I am trying to execute a script on remote server after ssh. The script on remote server is interactive,. Whenever it is called it hangs where it expects input from terminal and I have to terminate it. I have searched through fourm... (12 Replies)
Discussion started by: Jeevanm
12 Replies

7. Programming

Not able to ssh to other server from CGI script

Hi All, I have designed a web tool in perl cgi in UNIX Solaris 10 platform. According to my cgi script (in server A) it should execute a script (in server B) using ssh key authentication, but it is not. And when I am trying to execute the command without cgi script, the script in server B... (4 Replies)
Discussion started by: ankit_talwar
4 Replies

8. Shell Programming and Scripting

Script to SSH into a server

Hi, Actually i'm trying to write a script which needs to ssh into a server and run a command on the server, after entering a valid login. But after ssh the script will no longer run on the SSHed server :( so is there any way to do so ??? (1 Reply)
Discussion started by: nagios
1 Replies

9. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

10. Shell Programming and Scripting

Script to ssh to remote server

Hi All, I need to prepare a script. Description: Currently i am in server "x(ubuntu os)", here i need to develop a script to ssh to another server "y(ubuntu os)", i have password less authentication to "y". i have done the below #!/bin/bash #ssh to the server "y" and confirming i am... (2 Replies)
Discussion started by: kumar85shiv
2 Replies
SSH-COPY-ID(1)						      General Commands Manual						    SSH-COPY-ID(1)

NAME
ssh-copy-id - install your public key in a remote machine's authorized_keys SYNOPSIS
ssh-copy-id [-i [identity_file]] [user@]machine DESCRIPTION
ssh-copy-id is a script that uses ssh to log into a remote machine and append the indicated identity file to that machine's ~/.ssh/autho- rized_keys file. If the -i option is given then the identity file (defaults to ~/.ssh/id_rsa.pub) is used, regardless of whether there are any keys in your ssh-agent. Otherwise, if this: ssh-add -L provides any output, it uses that in preference to the identity file. If the -i option is used, or the ssh-add produced no output, then it uses the contents of the identity file. Once it has one or more fin- gerprints (by whatever means) it uses ssh to append them to ~/.ssh/authorized_keys on the remote machine (creating the file, and directory, if necessary.) NOTES
This program does not modify the permissions of any pre-existing files or directories. Therefore, if the remote sshd has StrictModes set in its configuration, then the user's home, ~/.ssh folder, and ~/.ssh/authorized_keys file may need to have group writability disabled manu- ally, e.g. via chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys on the remote machine. SEE ALSO
ssh(1), ssh-agent(1), sshd(8) OpenSSH 14 November 1999 SSH-COPY-ID(1)
All times are GMT -4. The time now is 07:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy