Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: Using environment variable in SCP

Suhas Majale

2008-03-20

Replies:
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}@(protected)}"
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@(protected):

> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--

Regards, Suhas Majale.
©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.