executing ssh from shell script

This is a discussion on executing ssh from shell script within the Linux Networking forums, part of the Linux Forums category; Hi, I am trying to execute a shell script on a remote machine using a shell script on the local ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-19-2008
R C V
 
Posts: n/a
Default executing ssh from shell script

Hi,
I am trying to execute a shell script on a remote machine
using a shell script on the local machine. I am not getting any
errors but the remote script is not getting executed.

Can you please tell me where I am going wrong.
The local shell script is as follows.

#!/bin/sh
ssh root@10.10.1.180 ~/testscripts/copyexecutable
exit

The copyexecutable script works fine if I ssh into the remote machine
and execute it from the command prompt.

TIA,
R C
Reply With Quote
  #2 (permalink)  
Old 03-19-2008
Robert Harris
 
Posts: n/a
Default Re: executing ssh from shell script

R C V wrote:
> Hi,
> I am trying to execute a shell script on a remote machine
> using a shell script on the local machine. I am not getting any
> errors but the remote script is not getting executed.
>
> Can you please tell me where I am going wrong.
> The local shell script is as follows.
>
> #!/bin/sh
> ssh root@10.10.1.180 ~/testscripts/copyexecutable


The tilda will be expanded by your local shell; try quoting it.

Robert

> exit
>
> The copyexecutable script works fine if I ssh into the remote machine
> and execute it from the command prompt.
>
> TIA,
> R C

Reply With Quote
  #3 (permalink)  
Old 03-23-2008
Carbon
 
Posts: n/a
Default Re: executing ssh from shell script

On Wed, 19 Mar 2008 08:38:17 +0000, Robert Harris wrote:
> R C V wrote:
>
>> I am trying to execute a shell script on a remote machine
>> using a shell script on the local machine. I am not getting any errors
>> but the remote script is not getting executed.
>>
>> Can you please tell me where I am going wrong. The local shell script
>> is as follows.
>>
>> #!/bin/sh
>> ssh root@10.10.1.180 ~/testscripts/copyexecutable

>
> The tilda will be expanded by your local shell; try quoting it.


If no absolute path is given the default directory in the ssh session
will be the remote user's home directory. Try

ssh root@10.10.1.180 "testscripts/copyexecutable"

I always quote remote commands out of habit although they shouldn't be
required unless there are spaces.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0