Sponsored Content
Operating Systems Solaris Help with executing multiple remote commands after multiple hops Post 302482706 by bluescreen on Wednesday 22nd of December 2010 10:16:34 AM
Old 12-22-2010
I think your issue is a "shell substitution before execution" issue. (See this section 2.1 #4) Try this:
Code:
/usr/bin/ssh -t $USER@$SERVER1 /usr/bin/ssh $USER2@S$SERVER2 echo uptime:\\\`/opt/OV/bin/snmpget -r 0 -t 60 $nodeName system.3.0 | cut -d: -f3-5\\\`

The "snmpget" was executing on $SERVER1. That's where the "snmpget: not found" error came. By using the backslashes, the execution is delayed until access to $SERVER2 is authenticated.


HTH

Last edited by bluescreen; 12-22-2010 at 01:37 PM..
This User Gave Thanks to bluescreen For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automating executing commands on multiple tapes and changing (loading) them

The thing that we need to be able to do is: - Scanning tapes from failed backup jobs with bscan (a bacula command) - loading the next tape with the mtx command Bscan does unload tapes but does not load them. Bscan comes with this message when it's done with a tape: Mount Volume... (0 Replies)
Discussion started by: Tr00tY
0 Replies

2. Shell Programming and Scripting

SSHing with multiple hops

Hi, I have got a shell script, which fails to run properly.. I am getting the following error: "Pseudo-terminal will not be allocated because stdin is not a terminal. Permission denied (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive)." I SSH to the machine and then run the... (1 Reply)
Discussion started by: LinuxUser2008
1 Replies

3. Shell Programming and Scripting

Need help with executing multiple commands in remote machine

Hi, I work on a jumpserver and I wrote a script to transfer a file from source server to destination server. #!/bin/ksh echo "\nEnter the file name:\n" read name echo "\nSelect the Source server\n" echo "1. ODS PROD " echo "2. ODS DROPBOX" echo "3. ODS STE" echo "4. ODS STE DROPBOX"... (6 Replies)
Discussion started by: ajayakunuri
6 Replies

4. Shell Programming and Scripting

perform 3 awk commands to multiple files in multiple directories

Hi, I have a directory /home/datasets/ which contains a bunch (720) of subdirectories called hour_1/ hour_2/ etc..etc.. in each of these there is a single text file called (hour_1.txt in hour_1/ , hour_2.txt for hour_2/ etc..etc..) and i would like to do some text processing in them. Each of... (20 Replies)
Discussion started by: amarn
20 Replies

5. IP Networking

http over ssh tunnel using multiple hops

Hello, I got an application on a linux server that I would like to access using https and a URL. I would like to create a ssh tunnel. But, let's say the app is on box C, but box C can only be accessed through box B, that can be accessed only through box A. I would like to create the ssh tunnel... (0 Replies)
Discussion started by: Pouchie1
0 Replies

6. Shell Programming and Scripting

Executing multiple ssh commands inside a shell simultaneously

I would like to execute a commands in four different servers through ssh at a single instance(simultaneously). Below are the details with examples, ssh user1@server1 "grep xxxx logs" ssh user1@server2 "grep xxxx logs" ssh user1@server3 "grep xxxx logs" Each statement will take some... (4 Replies)
Discussion started by: Amutha
4 Replies

7. Shell Programming and Scripting

Executing multiple commands in a file at same time

Hi Am having file.ksh as below wc -l file1.txt wc -l file2.txt wc -l file3.txt wc -l file4.txt i want all the commands in this file to execute in same time please help Thanks in advance (1 Reply)
Discussion started by: ragu.selvaraj
1 Replies

8. Shell Programming and Scripting

Ssh multiple hops to execute commands with arguments

Hi I need to write a script to ssh through several hops (e.g. HostA-HostB-HostC-HostD), where Host A does not have direct assess to HostC ; HostB cannot access HostD directly. when I ssh 3 hops and run command with arg1, arg2 and redirect the output to a file, e.g. HostA> ssh -t HostB ssh -t... (3 Replies)
Discussion started by: chiensh
3 Replies

9. Shell Programming and Scripting

Ssh to multiple hosts and then run multiple for loops under remote session

Hello, I am trying to login to multiple servers and i have to run multiple loops to gather some details..Could you please help me out. I am specifically facing issues while running for loops. I have to run multiple for loops in else condition. but the below code is giving errors in for... (2 Replies)
Discussion started by: mohit_vardhani
2 Replies

10. Shell Programming and Scripting

scp over multiple hops

Hi friends, I am trying to scp a file from server A to Server C via Server B (which is jump host) from Server A to Server B i have one pem key. from server B to server C I have different Pem key.. what I tried scp -r -o ProxyCommand="ssh -W %h:%p ec2-user@1.4.5.5 dmu.sh... (7 Replies)
Discussion started by: onenessboy
7 Replies
snmpget(1M)						  System Administration Commands					       snmpget(1M)

NAME
snmpget - communicate with a network entity using SNMP GET requests SYNOPSIS
/usr/sfw/bin/snmpget [common options] [-Cf] oid [oid...] DESCRIPTION
The snmpget utility is an SNMP application that uses the SNMP GET request to query for information on a network entity. You can specify one or more object identifiers (OIDs) as arguments on the command line. Each variable name must be specified in the format specified in snmp_variables(4) . For example, the command: # snmpget -c public zeus system.sysDescr.0 retrieves the variable system.sysDescr.0: system.sysDescr.0 = "SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m" If the network entity has an error processing the request packet, an error packet is returned and a message displayed. The message indi- cates the way in which the request was malformed. If there were other variables in the request that were correctly formed, the request will be resent without the bad variable. OPTIONS
The following option is supported: -Cf If -Cf is not specified, some applications (including snmpgetnext(1M) and snmpget) attempt to fix errors returned by the agent that you were talking to and resend the request. The -Cf option suppresses this fix-and-resend feature. Fix-and-resend is useful if you specified a nonexistent OID in your request and you are using SNMPv1, which requires "all or nothing" types of requests. In the following example note that system.sysUpTime is an incomplete OID, because it requires the .0 index appended to it: # snmpget -v1 -Cf -c public localhost system.sysUpTime system.sysContact.0 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. This name doesn't exist: system.sysUpTime # snmpget -v1 -c public localhost system.sysUpTime system.sysContact.0 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. This name doesn't exist: system.sysUpTime system.sysContact.0 = STRING: root@localhost In addition to this option, snmpwalk takes the common options described in the snmpcmd(1M) manual page. EXIT STATUS
0 Successful completion. 1 A usage syntax error. A usage message is displayed. Also used for timeout errors. 2 An error occurred while executing the command. An error message is displayed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsmcmd | +-----------------------------+-----------------------------+ |Interface Stability |External | +-----------------------------+-----------------------------+ SEE ALSO
snmpcmd(1M), snmp_variables(4), attributes(5) SunOS 5.10 20 Jan 2004 snmpget(1M)
All times are GMT -4. The time now is 03:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy