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 Thu, 20 Mar 2008 09:59:40 GMT
HI Steve,

Thanks for your reply, it was the same problem that you anticipated.
It was not loading the env variables, so I had a workaround for that.
Now my code works like this, I am setting the environment variable in the
.bash_profile and here is working piece of my code.

*<target name="remote-copy-solr-files"
depends="check-solrpath,copy_solr_files">
  <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="(. .bash_profile ; mv /tmp/${webapp.name} $SOLR_PATH)"
  failonerror="true"/>
*
Regards, Suhas M



On Tue, Mar 18, 2008 at 3:54 PM, Steve Loughran <stevel@apache.org> wrote:

> Suhas Majale wrote:
> > 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.
> >
>
> The issue here is that when you SSH in, you may not be running a login
> shell (as in bash -login), so env variables set in .bashrc /etc/profile
> may not be set.
>
> 1. add an echo $SOLR_PATH to your command list
> 2. force load whichever file sets the environment variables, with
> something like
>   source ~/.bashrc
>  (thats the tcsh operation; I dont use bash enough to be sure the
> syntax is correct. It may be
>  . ~/.bashrc
> 3. drive everything from property files in your local system
>
>
> --
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 

Regards, Suhas Majale.

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