LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   running script on ssh command line, want to see output (https://www.linuxquestions.org/questions/linux-newbie-8/running-script-on-ssh-command-line-want-to-see-output-884236/)

jeriryan 06-02-2011 07:56 PM

running script on ssh command line, want to see output
 
I'm trying to remotely run a script on a target machine though the ssh command-line using passwordless login. I know the keys are set up correctly because if I remove the call to the script, the ssh session succeeds and I can log into the remote machine, but when I call the csh script, I don't get any output on the command line. If I call an identical bash script, I do get the output. Specifically, calling line 1 below just returns me to the command line, but running line 2 echo's hello then returns to the command line (both scripts simply contain a single line to echo hello, and both work when run locally on the remote machine). Why do my csh scripts send any output through the ssh link whereas the bash does?

Code:

1) ssh -i /root/.ssh/id_rsa user@remotemachine /tmp/test.csh

2) ssh -i /root/.ssh/id_rsa user@remotemachine /tmp/test.bash

Update: I have further determined that nothing I add to the csh gets run either. I've tried touching files and making directories in the scripts, and all gets run using the bash script, but calling the csh script like line 1 above does nothing, nothing is touched or created.

Tinkster 06-02-2011 08:12 PM

Try
Code:

ssh -i /root/.ssh/id_rsa user@remotemachine "tcsh /tmp/test.csh"
and see what that does.


Cheers,
Tink

jeriryan 06-02-2011 08:17 PM

Quote:

Originally Posted by Tinkster (Post 4374621)
Try
Code:

ssh -i /root/.ssh/id_rsa user@remotemachine "tcsh /tmp/test.csh"
and see what that does.


Cheers,
Tink

Thanks for your reply. Gave it a shot, no dice. The csh script still doesn't run when called through the ssh command.

Tinkster 06-02-2011 08:49 PM

Silly question: is (t)csh actually installed on your target machine?

16pide 06-03-2011 05:29 AM

could you do a 2 lines script and try it:
Code:

[georges@t61 temp]$ vi lq.tcsh
[georges@t61 temp]$ chmod u+x lq.tcsh
[georges@t61 temp]$ ./lq.tcsh
hello lq
[georges@t61 temp]$ cat lq.tcsh
#!/bin/tcsh
echo "hello lq"

then try running it over ssh, something like this:
Code:

[georges@t61 temp]$ ssh georges@localhost /home/georges/temp/lq.tcsh
georges@localhost's password:
hello lq

Once that works, you can make things more complex


All times are GMT -5. The time now is 09:06 PM.