You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by venkata prasad <pr...@gmail.com> on 2007/10/24 14:12:33 UTC

SCP task to preserve exact time stamp

Hi All,

   I have a requirement like when ever i do build, i need to copy all
database files/folders from build machine to UNIX machine.

Right now i am uasing SCP Ant task for secure copy. But  it is not
preserving time stamp for all files and folder.

So i went for 'scp' unix command in exec -ant task . It is preserving time
stamp for some files and folders only.

Could some body help me,  in preserving time stamps for all folders and
files.

Thanks in advance,

Prasad U V.

Re: SCP task to preserve exact time stamp

Posted by Gilbert Rebhan <an...@schillbaer.de>.
venkata prasad wrote:
> Hi,
> 
> With your syntax, it is giving the below error.
> 
> /*   <exec executable="bash">
>           <arg line="scp -p -r /ccdata/oracle  /apps/oracle"/>
>      </exec>
> */
> 
> /usr/bin/scp:  can't execute binary file.
> 
> i am using bash shell.


hm, did you try in a shell ?
maybe you don't have the rights.

Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: SCP task to preserve exact time stamp

Posted by Alexis Votta <al...@gmail.com>.
That's because bash excepts a shell script as it's arguments.

Your <exec> translates to "bash scp -p -r ..." and scp is not a
script, it is a binary file. So it fails.

To execute any binary with bash, you need to give the -c argument.

bash -c scp -p -r ...

So you can adjust your <exec> task accordingly.

On 10/24/07, venkata prasad <pr...@gmail.com> wrote:
> Hi,
>
> With your syntax, it is giving the below error.
>
> /*   <exec executable="bash">
>           <arg line="scp -p -r /ccdata/oracle  /apps/oracle"/>
>      </exec>
> */
>
> /usr/bin/scp:  can't execute binary file.
>
> i am using bash shell.
>
>
> On 10/24/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
> >
> >
> > Hi,
> >
> > -----Original Message-----
> > From: venkata prasad [mailto:prasadeceonline@gmail.com]
> > Sent: Wednesday, October 24, 2007 3:15 PM
> > To: Ant Users List
> > Subject: Re: SCP task to preserve exact time stamp
> >
> > /*
> > But i am missing time stamp for some of the files and folders.
> >
> > Is it possible to know what are the files added/modified since last
> > copy?
> > */
> >
> > that's not the point you've asked for - "... preserving timestamps ..."
> >
> > for scp with preserving timestamps the solution which is working
> > perfectly for me is =
> >
> > <exec executable="ksh" failonerror="true">
> > <arg value="scp -p -r
> > ...
> >
> > maybe the syntax of your exec =
> >
> > <exec dir="." executable="scp">
> > <arg line="-p -r /ccdata/oracle  /apps/oracle"/>
> > </exec>
> >
> > is wrong ?!
> >
> > try with =
> >
> > <exec executable="ksh">
> > <arg line="scp -p -r /ccdata/oracle  /apps/oracle"/>
> > </exec>
> >
> > change ksh to your standard shell
> >
> >
> > Regards, Gilbert
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: SCP task to preserve exact time stamp

Posted by venkata prasad <pr...@gmail.com>.
Hi,

With your syntax, it is giving the below error.

/*   <exec executable="bash">
          <arg line="scp -p -r /ccdata/oracle  /apps/oracle"/>
     </exec>
*/

/usr/bin/scp:  can't execute binary file.

i am using bash shell.


On 10/24/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
>
>
> Hi,
>
> -----Original Message-----
> From: venkata prasad [mailto:prasadeceonline@gmail.com]
> Sent: Wednesday, October 24, 2007 3:15 PM
> To: Ant Users List
> Subject: Re: SCP task to preserve exact time stamp
>
> /*
> But i am missing time stamp for some of the files and folders.
>
> Is it possible to know what are the files added/modified since last
> copy?
> */
>
> that's not the point you've asked for - "... preserving timestamps ..."
>
> for scp with preserving timestamps the solution which is working
> perfectly for me is =
>
> <exec executable="ksh" failonerror="true">
> <arg value="scp -p -r
> ...
>
> maybe the syntax of your exec =
>
> <exec dir="." executable="scp">
> <arg line="-p -r /ccdata/oracle  /apps/oracle"/>
> </exec>
>
> is wrong ?!
>
> try with =
>
> <exec executable="ksh">
> <arg line="scp -p -r /ccdata/oracle  /apps/oracle"/>
> </exec>
>
> change ksh to your standard shell
>
>
> Regards, Gilbert
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

RE: SCP task to preserve exact time stamp

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 
Hi,

-----Original Message-----
From: venkata prasad [mailto:prasadeceonline@gmail.com] 
Sent: Wednesday, October 24, 2007 3:15 PM
To: Ant Users List
Subject: Re: SCP task to preserve exact time stamp

/*
But i am missing time stamp for some of the files and folders.

Is it possible to know what are the files added/modified since last
copy?
*/

that's not the point you've asked for - "... preserving timestamps ..."

for scp with preserving timestamps the solution which is working
perfectly for me is =

<exec executable="ksh" failonerror="true">
<arg value="scp -p -r 
...

maybe the syntax of your exec =

<exec dir="." executable="scp">
  <arg line="-p -r /ccdata/oracle  /apps/oracle"/>
</exec>

is wrong ?!

try with =

<exec executable="ksh">
  <arg line="scp -p -r /ccdata/oracle  /apps/oracle"/>
</exec>

change ksh to your standard shell


Regards, Gilbert





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: SCP task to preserve exact time stamp

Posted by venkata prasad <pr...@gmail.com>.
Hi Gilbert,

But i am missing time stamp for some of the files and folders.

Is it possible to know what are the files added/modified since last copy?

Cheers
Venkat.


On 10/24/07, Rebhan, Gilbert <Gi...@huk-coburg.de> wrote:
>
>
> Hi,
>
>
> -----Original Message-----
> From: venkata prasad [mailto:prasadeceonline@gmail.com]
> Sent: Wednesday, October 24, 2007 2:13 PM
> To: user@ant.apache.org
> Subject: SCP task to preserve exact time stamp
>
>
> /*
>   I have a requirement like when ever i do build, i need to copy all
> database files/folders from build machine to UNIX machine.
>
> Right now i am uasing SCP Ant task for secure copy. But  it is not
> preserving time stamp for all files and folder.
>
> So i went for 'scp' unix command in exec -ant task . It is preserving
> time
> stamp for some files and folders only.
>
> Could some body help me,  in preserving time stamps for all folders and
> files.
> */
>
> the parameters -p -r should do the job
>
> from the scp man page =
>
> "...
> -p   Preserves modification times, access times, and modes
>      from the original file.
>
> -r   Recursively copy entire directories.
> ..."
>
> here's a snippet from one of my scripts =
>
> <for list="${updatelist.@{Lum}}" param="copyfile">
> <sequential>
> <exec executable="ksh" failonerror="true">
> <arg value="scp -p -r ./@{Lum}/serverdata@{copyfile}
> svcscmcs@@@@@{server}:${scptarget}/@{Lum}/opt/andromeda@{copyfile}" />
> </exec>
> </sequential>
> </for>
>
>
> Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

RE: SCP task to preserve exact time stamp

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
Hi,


-----Original Message-----
From: venkata prasad [mailto:prasadeceonline@gmail.com] 
Sent: Wednesday, October 24, 2007 2:13 PM
To: user@ant.apache.org
Subject: SCP task to preserve exact time stamp


/*
   I have a requirement like when ever i do build, i need to copy all
database files/folders from build machine to UNIX machine.

Right now i am uasing SCP Ant task for secure copy. But  it is not
preserving time stamp for all files and folder.

So i went for 'scp' unix command in exec -ant task . It is preserving
time
stamp for some files and folders only.

Could some body help me,  in preserving time stamps for all folders and
files.
*/

the parameters -p -r should do the job

from the scp man page =

"...
-p   Preserves modification times, access times, and modes
      from the original file.

-r   Recursively copy entire directories.
..."

here's a snippet from one of my scripts =

<for list="${updatelist.@{Lum}}" param="copyfile">
<sequential>
<exec executable="ksh" failonerror="true">
<arg value="scp -p -r ./@{Lum}/serverdata@{copyfile}
svcscmcs@@@@@{server}:${scptarget}/@{Lum}/opt/andromeda@{copyfile}" />
</exec>
</sequential>
</for>


Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: SCP task to preserve exact time stamp

Posted by venkata prasad <pr...@gmail.com>.
Hi Nicolas,

Here is build script.

Initially i was using below SCP ant task to copy database files to remote
machine.

<scp todir="username@hostname:/apps/oracle <username@hostname:/apps/oracle>"

  password="ca0build1"
  trust="true"
  failonerror="true">
           <fileset dir="/ccdata/database/oracle">
        <include name="**/*.*"/>
               </fileset>

</scp>

But above one is not preserving time stamps..



So i am using below one.

<exec dir="." executable="scp">
  <arg line="-p -r /ccdata/oracle  /apps/oracle"/>
</exec>

This is also not preserving time stamp for all files and folders but not for
all.


Cheers
Prasad.


On 10/24/07, Bizard Nicolas (KIRO 41) <ni...@credit-suisse.com>
wrote:
>
> Hi
> can you describe a bit more, show some code (the fileset part for
> instance) ?
> Cheers
>
> -----Original Message-----
> From: venkata prasad [mailto:prasadeceonline@gmail.com]
> Sent: Wednesday, October 24, 2007 2:13 PM
> To: user@ant.apache.org
> Subject: SCP task to preserve exact time stamp
>
> Hi All,
>
>   I have a requirement like when ever i do build, i need to copy all
> database files/folders from build machine to UNIX machine.
>
> Right now i am uasing SCP Ant task for secure copy. But  it is not
> preserving time stamp for all files and folder.
>
> So i went for 'scp' unix command in exec -ant task . It is preserving
> time
> stamp for some files and folders only.
>
> Could some body help me,  in preserving time stamps for all folders and
> files.
>
> Thanks in advance,
>
> Prasad U V.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

RE: SCP task to preserve exact time stamp

Posted by "Bizard Nicolas (KIRO 41)" <ni...@credit-suisse.com>.
Hi
can you describe a bit more, show some code (the fileset part for
instance) ?
Cheers

-----Original Message-----
From: venkata prasad [mailto:prasadeceonline@gmail.com] 
Sent: Wednesday, October 24, 2007 2:13 PM
To: user@ant.apache.org
Subject: SCP task to preserve exact time stamp

Hi All,

   I have a requirement like when ever i do build, i need to copy all
database files/folders from build machine to UNIX machine.

Right now i am uasing SCP Ant task for secure copy. But  it is not
preserving time stamp for all files and folder.

So i went for 'scp' unix command in exec -ant task . It is preserving
time
stamp for some files and folders only.

Could some body help me,  in preserving time stamps for all folders and
files.

Thanks in advance,

Prasad U V.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org