Running script and commands through SSH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running script and commands through SSH
# 1  
Old 04-14-2011
Running script and commands through SSH

Hello All,
I am trying to run some simulations through SSH from my mac on our university SOLARIS system. My problem is that whenever I want to execute a command I get an error which says "Invalid argument".
Maybe I should explain more what I want to do and what I did.
Firstly I installed a software which I need to run, I did it through ThinLink, and it seems that it is running fine without a problems. I can execute all commands and scripts. Installed software contains tens of small programs. I have compiled it and assign the PATH to be able to use the software. This was still via ThinLink. Then I wanted to start to use SSH since it should be more secure and also faster for me. When I wanted to do same think as in ThinLink I got the message Invalid argument. For example I run a command which use program gensky.
I wrote:
Code:
gray1(dava) $ gensky 4 4 4

I got:
Code:
-bash: ............/Radiance_install/bin/gensky: Invalid argument
~

(i replaced the path to my home directory by dots)
The PATH to the program seams correct but it does not run correctly.
With SSH I can log into the remote machine and see all the files which I have on the disk as well as to run standard commands like mkdir etc. But I cannot run the programs which I installed.
Could anyone advice me on this or possible to show me some examples or give me some reference which I can study. I have tried to read man page for shh but it did not helped me that much since there is many things which I don't understand.
I am probably doing something wrong or missing something completely.

Thank you for any comments and advices.

Last edited by Apfik; 04-14-2011 at 03:32 PM..
# 2  
Old 04-14-2011
I don't think the man page for ssh will be helpful here.

There must be some difference between the environment when you login locally, and the environment when you login with ssh. Can you compare the output of env in both?
# 3  
Old 04-14-2011
Hello, thank your for response.
Should I look for anything specific? There is quite a lot information, and probably not all of them are relevant.

Quote:
Originally Posted by Corona688
I don't think the man page for ssh will be helpful here.

There must be some difference between the environment when you login locally, and the environment when you login with ssh. Can you compare the output of env in both?
# 4  
Old 04-14-2011
Quote:
Originally Posted by Apfik
Hello, thank your for response.
Should I look for anything specific? There is quite a lot information, and probably not all of them are relevant.
I can't be specific, sorry, I don't know what things in the environment the dozens of programs you mentioned use. I'm just wondering what's different. You could do:
Code:
# when logged in locally
env > localenv
# when logged in through ssh
env > remoteenv
diff localenv remotenv

to see the differences listed explicitly.
# 5  
Old 04-14-2011
There are some differences definitely, unfortunately I don't understand it. I have attached three files with info about the environment. envlocal (logged through ThinLink), envremove (logged through SHH) and their difference diff.
Maybe some one can see from the files what is the problem.
Thank you
# 6  
Old 04-14-2011
Your environments are so different there wasn't much point diffing it. I don't suppose you're getting a different shell when you ssh in than when you login locally?
# 7  
Old 04-14-2011
Quote:
Originally Posted by Corona688
Your environments are so different there wasn't much point diffing it. I don't suppose you're getting a different shell when you ssh in than when you login locally?
I am not sure if I understand it correctly. But I guess that not. When I ssh I use
Code:
ssh username@login.gbar.dtu.dk

However I am not logged exactly on the machine when I am "locally" logged because I also use remote access by ThinLink.

I guess that it can be something with permissions since regular things are working with shh but not newly installed programs. But I don't understnad that much all of this, so it could be also something else.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh - running commands on remote server

Hi, I am trying to run commands on a list of servers that I can ssh to and just want to know if there is a 'cleaner' way of doing this. At the moment, I am doing as below. Is there a way that I can escape the double quote differently? If a use a single quote to enclose the commands that I... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Shell Programming and Scripting

Perl script running multiple commands at once

Hi All, I have put a perl script together to go and collect some information from multiple nodes/endpoints. The script works absolutly fine however I want to make it quicker. You will see in the below that my script calls an expect script called ssh_run_cmd2.exp followed by the IP of... (7 Replies)
Discussion started by: mutley2202
7 Replies

3. Shell Programming and Scripting

Running Commands on a Remote Linux Server over SSH

Hello, I'm trying to create a ksh script to ssh to a remote server, enter the password and a couple commands. For security reasons I have changed the login, password and ip in my example. #!/bin/ksh ssh -t -t username@12.5.5.3 << EOF password cd bin pwd EOF When I run it. It... (5 Replies)
Discussion started by: seekryts15
5 Replies

4. Shell Programming and Scripting

Issue with running commands from shell script

I'm trying to copy files from a remote windows server to Unix server. I was successfully able to copy files from windows server using command prompt but when I run these commands from a script it's not working as expected. commands used: sftp user@remoteserver.com lcd local_dir cd... (3 Replies)
Discussion started by: naresh7590
3 Replies

5. Shell Programming and Scripting

Execute ssh commands through bash script

Hi all! I am trying to write a script that will check if a certain directory is available at several different nodes and then do stuff in it ..... On the beginning of the script I give as a variable the directory and the number of the nodes and then I loop like this: for... (3 Replies)
Discussion started by: idet2
3 Replies

6. Shell Programming and Scripting

Alert for long running commands in script

Hi All, Is there a way in which a long running command can terminate by itself inside a script? I need something like below: echo Start <command> exit If the <command> is taking more than say 100 seconds to complete, the script should exit without manual intervention. Thanks, Deepak (2 Replies)
Discussion started by: deepakgang
2 Replies

7. Shell Programming and Scripting

Running unix commands in a perl script

Executing two unix commads via perl script one after another e.g: make clean bsub -i -q short make have tried using exec but the second command doesnt executes (1 Reply)
Discussion started by: rajroshan
1 Replies

8. Shell Programming and Scripting

running script in cron - with ssh commands - not working

I ran an ssh command to run a script on a remote server ssh -l <user> <servername> /path/to/script/scriptname This works fine - and the script is executed correctly. However - I put this command into a script, that I want to run from cron every hour, to execute the file on the remote... (31 Replies)
Discussion started by: frustrated1
31 Replies

9. Shell Programming and Scripting

Adding ssh commands to a shell script

I have written some scripts that do a few admin tasks on 23 servers I manage. Usually I execute these scripts from one server by running ssh commands remotley, i.e. ssh root@server2 shellscript, ssh root@server2 shellscript & so on.. It works fine but I want to improve this by writing a... (3 Replies)
Discussion started by: Moxy
3 Replies

10. Shell Programming and Scripting

running commands from script

I'm new to unix and I have a fairly simple problem: Lets say I am in a specific directory and I run the command: "dirs" , I get an output of all the folders that i pushed into the stack (as expected), buut, when when I create a script (called test): #! /bin/csh dirs and then i run:... (2 Replies)
Discussion started by: owijust
2 Replies
Login or Register to Ask a Question