ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Suhas Majale" <suha...@gmail.com>
Subject Re: Using environment variable in SCP
Date Tue, 18 Mar 2008 09:57:40 GMT
I am using properties file, in which *solr.home.path=$SOLR_PATH*

Even it fails when I try with

 command="cp -rvf /tmp/solr/${webapp.name} $SOLR_PATH"
or
 command="cp -rvf /tmp/solr/${webapp.name} $$SOLR_PATH"
or
command="cp -rvf /tmp/solr/${webapp.name} $$SOLR_PATH"

Regards, Suhas M.

On Tue, Mar 18, 2008 at 2:31 PM, <Jan.Materne@rzf.fin-nrw.de> wrote:

> I thought you want to use the env variable in your "scp"
>  <sshexec trust="true"
>   host="${host}"
>   username="${remote.user}"
>   password="${remote.password}"
>   command="cp -rvf /tmp/solr/${webapp.name} $SOLR_PATH"
>   failonerror="true"/>
>
> (maybe you have to mask the $ by $$).
>
> You could also start Ant with -v(erbose) or -d(ebug) mode.
> Usually you'll see the command Ant tries to execute.
>
>
> Jan
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: Suhas Majale [mailto:suhasrm@gmail.com]
> > Gesendet: Dienstag, 18. März 2008 09:36
> > An: Ant Users List
> > Betreff: Re: Using environment variable in SCP
>  >
> > Hi Jan,
> >
> > Thanks for the reply and the work around you suggested.
> > I am copying the files in the /tmp/solr folder and using the
> > sshexec to copy
> > the directory from /tmp/solr to $SOLR_HOME (/root/solr-deploy/solr/)
> > Here is my piece of ant script.
> >
> > *<scp
> > remoteTodir="${remote.user}:${remote.password}@${host}:${tmp.path}"
> > trust="true" sftp="true">
> > <fileset dir="solr"/>
> > </scp>
> > <sshexec trust="true"
> >   host="${host}"
> >   username="${remote.user}"
> >   password="${remote.password}"
> >   command="cp -rvf /tmp/solr/${webapp.name} ${solr.home.path}"
> >   failonerror="true"/> *
> > **
> > Now when I do this, I get the following error
> >
> > *remote-copy-solr-files:
> >   [scp] Connecting to 192.168.0.130:22
> >   [scp] done.
> >   [sshexec] Connecting to 192.168.0.130:22
> >   [sshexec] cp: missing destination file operand after
> > `/tmp/solr/test1'
> >   [sshexec] Try `cp --help' for more information.*
> >
> > When I give the command as *"cd ${solr.home.path}"* it works,
> > but it do not
> > work when used with *cp*
> > **
> > Also form the shell prompt it works.
> > *cp -rf /tmp/solr/test1 $SOLR_PATH*
> > **
> > So is it something it has to do with the cp command?
> >
> > Regards, Suhas M.
> >
> > On Tue, Mar 18, 2008 at 12:16 PM, <Jan.Materne@rzf.fin-nrw.de> wrote:
> >
> > > When working with remote tasks like <scp> we have to distinguish
> > > between two environments: the env from the local and the
> > remote machine.
> > >
> > > You can use the local environment by loading them into properties.
> > >    <property environment="env"/>
> > >    <scp remoteTodir="${remote.user}:${remote.password}@${host}:${
> > > env.SOLR_HOME}/">
> > >
> > > I dont think that you can use the remote environment.
> > > What you could do as workaround is
> > >    1. <scp> to a tmp directory
> > >    2. <sshexec> to move the files
> > > Because the <sshexec> works on the remote machine you
> > should have access
> > > the the
> > > remote environment variables.
> > >
> > >
> > > Jan
> > >
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Suhas Majale [mailto:suhasrm@gmail.com]
> > > > Gesendet: Dienstag, 18. März 2008 07:08
> > > > An: user@ant.apache.org
> > > > Betreff: Using environment variable in SCP
> > >  >
> > > > HI all,
> > > >
> > > > I am very new to ant and am using the SCP to transfer files
> > > > from windows to
> > > > linux (FC 6) machine.
> > > > Following is the code,
> > > >
> > > > *<scp remoteTodir="${remote.user}:${remote.password}@${host}:${
> > > > solr.home.path}/" trust="true" sftp="true">*
> > > > *<fileset dir="solr"/>
> > > > </scp>**
> > > > *
> > > > The *solr.home.path* is getting read from the associated
> > > > properties file.
> > > > When I assign absolute path for solr.home.path the transfer works
> > > > successfully.
> > > > i.e *solr.home.path=/root/solr-deploy/solr*
> > > >
> > > > Now instead of giving the absolute path, I tried giving
> > > > environment variable
> > > > that is set for that path. When I do so, the transfer fails.
> > > > *solr.home.path=$SOLR_HOME*
> > > >
> > > > Can we use environment variable in SCP ? If yes, what is the
> > > > way we do it?
> > > >
> > > > Regards, Suhas M
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> >
> >
> > --
> > --------------------------------------------------------------
> > --------------------------------------------------------------
> > ----------
> > Regards, Suhas Majale
> > Developers - we trust, rest - we test.
> >
> > Mobile: +91 988 667 9108
> > Off Direct: +91 80 4178 9139
> > http://www.CoreObjects.com <http://www.coreobjects.com/>
> > --------------------------------------------------------------
> > --------------------------------------------------------------
> > ----------
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
--------------------------------------------------------------------------------------------------------------------------------------
Regards, Suhas Majale
Developers - we trust, rest - we test.

Mobile: +91 988 667 9108
Off Direct: +91 80 4178 9139
http://www.CoreObjects.com
--------------------------------------------------------------------------------------------------------------------------------------

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message