Connection between 2 machines via shell


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Connection between 2 machines via shell
# 1  
Old 11-13-2014
Connection between 2 machines via shell

Friends like I do the following

To have a machine where I have a shell, which when run should go to a B machine which should take a few files and apply awk several validations and if that is correct execute a Procedure which is in machine B, it is possible to do that?

Last edited by vbe; 11-13-2014 at 09:33 AM.. Reason: Why code tags? you have no code here!
# 2  
Old 11-13-2014
If you can ssh into machine B, you can run this on machine A:

Code:
# arg1, arg2 etc are any variables you wish to pass into the script,
# since variables are NOT expanded inside the here document.
ssh username@machineb exec bash -s "arg1" "arg2" <<"EOF"
echo "argument1 is $1"
echo "argument2 is $2"

if [ statement ]
then
        dosomething
else
        dosomethingelse
fi

# Note that the next line is not and MUST NOT BE indented
EOF

if [ "$?" -ne 0 ]
then
        echo "The remote script couldn't do something"
fi

Everything in red is the script which will be run on machineb.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help! Shell Script for Wifi Connection

Hi, I am quite new to shell scripting and was wondering if it was possible to automatically enter the username and password fields to a wifi-access-router and then ping it. I have most trouble with entering the username and password fields. Is that even possible? Also, what do I do if the... (1 Reply)
Discussion started by: Xyn
1 Replies

2. Shell Programming and Scripting

Connection with Teradata through shell Script

Hi All, As we are using SQLPLUS command to connect Oracle Database in unix: Like below syntax: sqlplus username/password@dbname << EOI SET HEADING OFF SPOOL MAX_DATE_VAL.txt select max(LAST_UPDT_DATE) from source_defect; SPOOL OFF here the result is stored in... (0 Replies)
Discussion started by: Shilpi Gupta
0 Replies

3. Shell Programming and Scripting

Shell Script to find out if a process is running on any all machines

Hi All, I have been a guest visitor from a long time and this forum is wonderful. I finally am a member of this forum too, so i am here stuck with a shell script that i was trying to write My requirement is that i should be able to create a shell script which will check if a process is running on... (3 Replies)
Discussion started by: Rex0226
3 Replies

4. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

5. Shell Programming and Scripting

SFTP connection using shell script

Hi , I am able to manually connect to remote system usning "sftp" protocol. But when I using the below command in the script but I am not able to connect. `sftp TEST01@120.34.3.4` And the connection should not be closed after login. Please help to solve this. Thanks Satya (2 Replies)
Discussion started by: Satyak
2 Replies

6. Shell Programming and Scripting

oracle connection from shell script

Hi, For connecting to oracle my script is using the command sqlplus username/password@db_instance_name.For this to work i am setting ORACLE_HOME,TNS_ADMIN and ORACLE_SID in a seperate script.My question is,could we make a connection to oracle just by the command sqlplus... (4 Replies)
Discussion started by: DILEEP410
4 Replies

7. UNIX for Dummies Questions & Answers

sybase connection through shell-script

:mad: how do i connect to sybase through shell script written in linux (9 Replies)
Discussion started by: Amitabh
9 Replies

8. Shell Programming and Scripting

Connection to database through shell script

Hi when i am calling the shell script with two parameter like id and date it works fine.But the same shell script is call by java application it gives the error as shown below Thu Jan 8 04:13:22 EST 2009|The Get Segment Process Failed: SP2-0306: Invalid option. Usage: CONN where <logon>... (1 Reply)
Discussion started by: ravi214u
1 Replies

9. Shell Programming and Scripting

how to check DB connection in unix shell script

In the following script I need to find whether DB is established successfully or not. I need to find and display it. If <DB is connected successfully> then echo "DB connection success" else echo "DB connection failure" fi In the same way I need to do it for DB terminate. I don't... (1 Reply)
Discussion started by: kmanivan82
1 Replies

10. UNIX for Dummies Questions & Answers

no shell connection closed error

Hi, I have created some users on my new enviroment on sun solaris in the aptempt to create a .profile which I did. I must have done something wrong because when I try to connect to one of this users it says:no shell, connection closed. The only thing I can think is that in my .profile I inserted... (2 Replies)
Discussion started by: giulianob
2 Replies
Login or Register to Ask a Question