Connect to target host from Source host.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Connect to target host from Source host.
# 1  
Old 11-06-2013
Connect to target host from Source host.

Hi All,

Need to connect to target host and execute a command and connect back to source host to continue with next set of command execution.

Is there a utility/command using which we can connect to target host ?

Please suggest.

Note: Netezza database is instaled on Linux server.


Thanks and Regards
Nagaraja Akkivalli
# 2  
Old 11-06-2013
perhaps you can use expect script
# 3  
Old 11-06-2013
Did you consider ssh?
This User Gave Thanks to RudiC For This Post:
# 4  
Old 11-06-2013
You can use SSH to do this
Syntax:
Code:
sshusername@ipaddress ‘command’
 ssh username@domainname ‘command’
 ssh username@domainname ‘command1 | command2′


Examples

Code:
ssh tts@192.168.1.9 ‘df -Th’
ssh tts@192.168.1.9 ‘ls -l /etc/httpd’
ssh tts@192.168.1.9 ‘grep -i tts /etc/passwd’

Add the single line command in the script to execute a command in the remote machine.

Last edited by Franklin52; 11-06-2013 at 10:25 AM.. Reason: Please use code tags, thanks
This User Gave Thanks to linuxrulez For This Post:
# 5  
Old 01-31-2014
Thanks for your reply!!

I was able to achieve it using ssh command in quotes as you suggested.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to connect to a DB installed on another host using shell script?

Hi Experts There are two hosts say A and B. On host B, Oracle DB is installed and running. I am trying to check if the DB on host B is up and running fine from a script on host A. Is this possible. I tried using commands like sql plus but those doesn't seem to help. Could you please guide. (8 Replies)
Discussion started by: harishshankar
8 Replies

2. Solaris

Need to recover/move diskgroup from failed host to another host

Hi All I am having VxVm on two Solaris hosts. host1 is using disk group dgHR. right now this server went down due to hardware fault. Not I need to import this dgHR into host2 server. Please let me know the procedure for the same. (1 Reply)
Discussion started by: amity
1 Replies

3. UNIX for Dummies Questions & Answers

Transfer large number of files host to host

Hello.... I have two servers, one has an empty / and the other has a subdirectory with a large number (4 gig) with many, many files. I need a way to transfer the files en masse from the server with the large number of files to the one that is essentially blank. I don't have space on the used... (16 Replies)
Discussion started by: blaine.miller
16 Replies

4. UNIX for Advanced & Expert Users

Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1. When I do a who -m from A2, I see the "connected from" as "A1". => who -m userid pts/2 2010-03-27 08:47 (A1) I want to identify who is the local host who initiated the connection to... (3 Replies)
Discussion started by: gomes1333
3 Replies

5. Solaris

Iscsi - target + initiator on the same host.

Hi all iscsiadm / iscsitadm. Ive created two devices on a host. # iscsitadm list target Target: 1-disk0 iSCSI Name: iqn.1986-03.com.sun:02:f105ddf3-52a4-ed7a-9590-c3d354b8fc32.1-disk0 Connections: 1 Target: 1-disk1 iSCSI Name:... (0 Replies)
Discussion started by: sbk1972
0 Replies

6. Shell Programming and Scripting

running commands to remote host from centralized host

Gurus/Experts We have a centralized UNIX/Solaris server from where we can actually ssh to all other UNIX/Solaris servers...I need to write a script that reside on this centerlized server and do FileSystem monitoring (basically run df -h or -k) of other remote servers and then send an email to me... (6 Replies)
Discussion started by: anjum.suri
6 Replies

7. Programming

Host to IP Source Code in C - Questions! Please Help

Hello, First of all, i want to say Hi! Glad to join your forum and be your member. I'm a newbie towards C/C++ especially on network programming. What is the definition of getaddrinfo()? int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, ... (4 Replies)
Discussion started by: f.ben.isaac
4 Replies

8. Solaris

How to delete the files from local host to remote host

Hi all, i am copying .gz files from production server to development server using "scp" command.my requirement is after copying .gz files i want to delete old .gz files(two days back) in development server from production server. like this way i need to delelte .log ,.z and .dmp files... (3 Replies)
Discussion started by: krishna176
3 Replies

9. UNIX for Dummies Questions & Answers

add route gives target: Host name lookup failure

We need to add our remote office to our linux routing table. Our internal office ip addresses are all in the range of 198.9.200.x with an subnet mask of 255.255.255.0 the remote office has ip addresses in the range of 192.168.0.0 and also a subnet mask of 255.255.255.0 when i use the... (3 Replies)
Discussion started by: progressdll
3 Replies

10. IP Networking

QNX host cannot ping SCO host, vice versa

The problem I am facing now is that the QNX host could not ping the SCO host and vice versa. They are in the same domain, ie, 172.20.3.xx. As I am very new to Unix, I guess I must have missed out some important steps. Pls help... Thanx alot (2 Replies)
Discussion started by: gavon
2 Replies
Login or Register to Ask a Question