Execute script located on a remote machine


 
Thread Tools Search this Thread
Special Forums IP Networking Execute script located on a remote machine
# 8  
Old 07-05-2012
Can you run the commands interactively through Plink ok?
So can you:

Code:
plink user@remotehost

and then run the commands individually?

I'm also not sure where the
Code:
sh: /export/home/ms104u/test.sh: No such file or directory

comes from unless you're using symlinks.
# 9  
Old 07-05-2012
Error

I have some clue if it help other resolve my error.

Code:
plink -v -ssh user1@remotehost pwd
Password:
Access granted
Opened channel for session
Started a shell/command
/home/CSDEV13-PT/user1
Server sent command exit status 0
Disconnected: All channels closed

However when i login to remotehost using putty and fire this command

Code:
user1@csdev13: /export/home/user1 $ cd /home/CSDEV13-PT/user1
ksh: /home/CSDEV13-PT/ms104u:  not found
user1@csdev13: /export/home/user1 $ hostname
csdev13

Kindly help !!
# 10  
Old 07-05-2012
What version of *nix are you trying to connect to?

Can you use some folder outside of home, like /var/tmp/ to see if that works? It looks like it might have something to do with the way your home directory is being mounted or at least referenced.
This User Gave Thanks to spynappels For This Post:
# 11  
Old 07-05-2012
Error

I think I have moved a step further.

The remote ip that i was giving to plink is NOT the actual remote ip that has the x.sh script.

The reason it asked for password twice using putty is once for the remotehostA and then it somehow automatically switches to some other RemoteServerB which then asks for the password again.

Can you help me determine where and how is the automatic hopping from remoteserverA to remoteserverB happening ? where and what to look inorder to reveal the mystery.

Because I will eventually need to incorporate this hopping mechanism in my plink windows script inorder to automate everything.
# 12  
Old 07-05-2012
I'm afraid I can't help you with that, I simply don't know. I suspect it may have something to do with how NFS shares are mounted, but without more details of your exact network layout and OSs etc, I don't think anyone would be able to help much further.

Do the commands I suggested work if run using a fixed folder like /var/tmp/ on the first remote server?
# 13  
Old 07-05-2012
Lightbulb

Quote:
Originally Posted by spynappels
I'm afraid I can't help you with that, I simply don't know. I suspect it may have something to do with how NFS shares are mounted, but without more details of your exact network layout and OSs etc, I don't think anyone would be able to help much further.

Do the commands I suggested work if run using a fixed folder like /var/tmp/ on the first remote server?
Yes they do run.

However, my job's pending unless I get this hopping of unix server sorted out.

Any clues by any one to begin with.

Shall I open a new Thread for this or should I expect response on this thread.
# 14  
Old 07-05-2012
Ok, first things first.

Can you describe in as much detail as you can what the network topology of your systems is?

Also, can you confirm which flavour of Unix you are running on each server?

Lastly, can you check if home directories are mounted via nfs or use some other distributed file system?

I'll take this as far as I can and hopefully get enough info to point to the right place to solve this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I execute local script on remote machine and include arguments?

I have a script in local server cd /home/dell/work/BOP/testdir ./processchk po (here processchk is a script & po is passed as an argument) Now I want to execute this script from remote server ssh $username@$hostname "cd /home/dell/work/BOP/testdir; ./processchk po" But Its getting error... (9 Replies)
Discussion started by: manohar2013
9 Replies

2. Shell Programming and Scripting

Execute shell script on remote machine

I want to execute a shell script(set of commands) on remote machine and that script takes input from text file(local machine). Please refer below: ssh user@hostname 'bash -s'< ./test.sh file.txt But i got the error file.txt doesn't exist. Can anyone help me on this. Content of test.sh: ... (2 Replies)
Discussion started by: manishtri88
2 Replies

3. UNIX for Dummies Questions & Answers

Execute shell script in remote machine

Hi All, We have 2 servers A and B. B is having a sctipt called b.sh in path /home/dev/scripts. Now my requirement is i want to execute b.sh from server A. Kindly help me. (3 Replies)
Discussion started by: Girish19
3 Replies

4. Shell Programming and Scripting

How to execute the same script on another machine

Recently, I need to generate a lot of files from a few master files. In fact, if I relogin to the server machine, my operating would be much faster. My question is this: Can I write a script in which the current path can be automatically saved and relogin to the server to execute my command in the... (0 Replies)
Discussion started by: jiao
0 Replies

5. Shell Programming and Scripting

To execute the same script in another machine

We have a few machines which share the same directory. How can I execute the same script under that directory in different machine while I am using mine? (1 Reply)
Discussion started by: jiao
1 Replies

6. Shell Programming and Scripting

unix shell script which inserts some records into a file located in remote servers...

All, I need to write an unix shell script which inserts some records into a file located in remote servers. * Get the input from the user and insert according the first row. It should be in ascending order. 123451,XA,ABA 123452,XB,ABB 123453,XC,ABC 123455,XE,ABE 123456,XF,ABF 123458,XG,ABG... (2 Replies)
Discussion started by: techychap
2 Replies

7. Shell Programming and Scripting

Change user on remote machine and execute script!

Hi, I need to login into remote server and execute a shell script over there. As of now i am making use of ssh command ssh primUser@135.254.242.2 sh /poll.sh I am logging in as primUser but unless i change the user to root the script execution on the remote machine is not possible. ... (5 Replies)
Discussion started by: goutham4u
5 Replies

8. Shell Programming and Scripting

How to execute a script hosted on a machine from a different machine

Hi everyone I intend to trigger a script from one machine say mc1 that actually excutes on different machine say mc2 and redirect the logs to that machine mc2. I tried to use nohup <nfs location of machine >/script.sh > <nfs location of machine >/script.log 2>&1 & nfs location of... (2 Replies)
Discussion started by: harneetmakol
2 Replies

9. Shell Programming and Scripting

Execute command from terminal on remote machine

Hi All, I want to execute some commands on unix machine from the mac machne. I have two options for doing so, I am confused which is the best way of doing. Here are two options. Requirement: Execute command on the remote server machine. Commands to be executed itself contain arguments to be... (0 Replies)
Discussion started by: Ranu
0 Replies

10. Shell Programming and Scripting

how to execute a script on remote machine

hi unix guru's i am new to unix shell programming. i found a trouble in executing a script(bali.ksh) which is available on serverA with username xyza, this script contains sqlplus command to retrive the data from the database available on other serverC. Now i need to run the above script... (4 Replies)
Discussion started by: balireddy_77
4 Replies
Login or Register to Ask a Question