Unless I'm overlooking something with sshexec it doesn't accomplish my task 
either.  That may be because I don't see a way to use any ssh options (like the 
-t).
The task I used:
        <sshexec host="${remote.host}" failonerror="true"
                username="mylocaluser"
                keyfile="${user.home}/.ssh/id_dsa"
                command="/usr/local/bin/sudo -u myuser 
/path/to/deploy_build.sh" />



I also tried using a local shell script.  Which takes a single argument (the 
hostname) and runs the ssh command.  Similarly, this works from the command 
line but not from ant.

The shell script (remote_deploy.sh):
#! /bin/bash

remotehost=$1

echo "ssh to $remotehost"

ssh -t $remotehost /usr/local/bin/sudo -u myuser /path/to/deploy_build.sh

The ant call of the script:
      <exec executable="bash">
                <arg line="./remote_deploy.sh ${remote.host}" />                
                                </exec>


Any idea whether my issue is lies with ant or solaris?

Thanks to all who have offered advice!
Barry


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 21, 2008 12:10 AM
To: user@ant.apache.org
Subject: AW: exec with -t argument

<sshexec> ?
That uses a java api instead of using a command line executable.

Jan 

> -----Ursprüngliche Nachricht-----
> Von: Barry Pape [mailto:[EMAIL PROTECTED] 
> Gesendet: Freitag, 18. Januar 2008 18:34
> An: Ant Users List
> Betreff: RE: exec with -t argument
> 
> Hmmm, yeah..not sure how I forgot to do that...
> 
> So ant is calling the command that works on the command line, 
> but specifies '[exec] Pseudo-terminal will not be allocated 
> because stdin is not a terminal.'  In researching this some, 
> I found advice to either use '-t -t' to force the allocation 
> of a pty or '-T' to disables tty creation on the client side. 
>  Neither of these or the combination of them seems to be 
> working for me.  Any ideas, or is there another way to 
> accomplish executing a remote script that I should look into?
> 
> 
> deploy.build:
>      [exec] Current OS is SunOS
>      [exec] Executing 'ssh' with arguments:
>      [exec] '-t'
>      [exec] 'myserver.net'
>      [exec] '/usr/local/bin/sudo'
>      [exec] '-u'
>      [exec] 'myuser'
>      [exec] '/path/to/deploy_build.sh'
>      [exec]
>      [exec] The ' characters around the executable and arguments are
>      [exec] not part of the command.
>      [exec] Pseudo-terminal will not be allocated because 
> stdin is not a terminal.
> 
> 
> Thanks,
> Barry
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 18, 2008 12:34 AM
> To: user@ant.apache.org
> Subject: AW: exec with -t argument
> 
> Can you run Ant in -verbose or -debug mode and post the 
> execution command?
> Maybe you could try that generated command directly on command line.
> 
> Jan 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Barry Pape [mailto:[EMAIL PROTECTED] 
> > Gesendet: Freitag, 18. Januar 2008 01:52
> > An: Ant Users List
> > Betreff: exec with -t argument
> > 
> > Howdy Ant Friends,
> > 
> > I am having an issue with running a deploy script on a 
> remote server.
> > This command works beautifully:
> > 
> > ssh -t myserver.net /usr/local/bin/sudo -u myuser
> > /path/to/deploy_build.sh
> > 
> > But when I invoke this command using exec in ant the '-t' 
> > argument does
> > not get used.  Otherwise the remote script is run and 
> everything looks
> > good (the app is deployed and jboss is started).  In the 
> > script, we run
> > the command 'nohup ./run.sh &' and without the '-t' nohup 
> is not used.
> > This results in the output that would normally go to nohup.out to be
> > dumped to the invoking shell and the build to hang because 
> > now the shell
> > is being used for the standard output jboss produces.  I have 
> > tried exec
> > with all <arg value="">, with <arg line=""> only, and various
> > combinations of the two.  My google and mail archive 
> searches thus far
> > have been unsuccessful in finding a similar issue.  Any 
> > suggestions are
> > much appreciated.
> > 
> > My ant target:
> >    <target name="deploy.build">
> >         <exec executable="ssh">
> >         <!--    <arg value="-t" />
> >                 <arg value="${remote.host}" />
> >                 <arg value="/usr/local/bin/sudo" />
> >                 <arg value="-u" />
> >                 <arg value="myuser" />
> >                 <arg value="/path/to /deploy_build.sh" />-->
> >                 <arg line="-t ${remote.host} /usr/local/bin/sudo -u
> > myuser /path/to /deploy_build.sh" />
> >         </exec>
> >    </target>
> > 
> > 
> > Both the invoking server and remote server are running solaris.
> > 
> > 
> > Thanks,
> > Barry
> > 
> > 
> > 
> > -----------------------------------------
> > Confidentiality Notice!
> > This electronic transmission and any attached documents or other
> > writings are confidential and are for the sole use of the intended
> > recipient(s) identified above. This message may contain information
> > that is privileged, confidential or otherwise protected from
> > disclosure under applicable law. If the receiver of this
> > information is not the intended recipient, or the employee, or
> > agent responsible for delivering the information to the intended
> > recipient, you are hereby notified that any use, reading,
> > dissemination, distribution, copying or storage of this information
> > is strictly prohibited. If you have received this information in
> > error, please notify the sender by return email and delete the
> > electronic transmission, including all attachments from your
> > system.
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to