LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-02-2011, 07:56 PM   #1
jeriryan
Member
 
Registered: Apr 2003
Location: United States
Distribution: RHEL 5.4, Snow Leopard
Posts: 87

Rep: Reputation: 15
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.

Last edited by jeriryan; 06-02-2011 at 07:59 PM.
 
Old 06-02-2011, 08:12 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Try
Code:
ssh -i /root/.ssh/id_rsa user@remotemachine "tcsh /tmp/test.csh"
and see what that does.


Cheers,
Tink
 
Old 06-02-2011, 08:17 PM   #3
jeriryan
Member
 
Registered: Apr 2003
Location: United States
Distribution: RHEL 5.4, Snow Leopard
Posts: 87

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tinkster View Post
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.
 
Old 06-02-2011, 08:49 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Silly question: is (t)csh actually installed on your target machine?
 
Old 06-03-2011, 05:29 AM   #5
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reading command output by line in Bourne script? ocicat Programming 6 02-14-2010 02:48 AM
running a php script from command line leicaphotos Linux - Newbie 1 10-10-2008 01:24 PM
Perl: Running Command line apps in background and capturing output s0l1dsnak3123 Programming 8 03-28-2008 01:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration