0
votes

I've recently taken over responsibility of a Cruise Control continuous integration server, although I know very little about either Cruise Control or Nant. But, such is life.

One of the regular build jobs this is supposed to do is to execute a Nant script that backs up files and data from one of live servers to a backup server. I've discovered that this has been failing pretty much as far back as user interface will let me see.

The error message is always the same:

Build Error: NAnt.Core.BuildException
Cannot copy '[filename].bak' to '[server]'.

But it doesn't always fail at exactly the same spot.

The Nant script that's executing is pretty much several iterations of this copy code:

<copy todir="${backup.root}\{dirname}">
    <fileset basedir="s:">
        <include name="**/*" />
    </fileset>
</copy> 

Although some of the commands are 'move' rather than 'copy'.

The fact this happens at different points in the scripts suggests to me that this is either down to a timeout, or to the script being unable to access files that in use by the system when the script is running. But I've never been able to get a successful execution through, no matter what time of day I set it to run.

The error messages are not particularly helpful in identifying what the problem actually is. And googling them is not particularly enlightening. I'm not expecting a solution to this (though one would be nice) - but it'd be enormously helpful if I could just get some pointers on where to look next in terms of identifying the problem.

2

2 Answers

1
votes

As this is a backup you could set the copy task to proceed on failure until you identify the problem. Obviously you don't want to leave it that way permanently.

See http://nant.sourceforge.net/release/0.85/help/tasks/copy.html

I would add the verbose='true' and failonerror='false' attributes to the copy task and see if that helps.

Setting overwrite based on your scenario may also help.

1
votes

First of all extract the Nant section to a sandbox Nant file and run Nant on your own from command line so you don't have to wait to test until the scheduled backup time each day. Basically setup a testbed for ease of testing.

Then run it and see where it fails. Then shorten the nant task till it works no matter how little work it's doing. Now you should know what first causes it to fail. Focus on that.

I've used Nant a fair amount and:

Cannot copy '[filename].bak' to '[server]'

makes me think some properties aren't being resolved. Why would someone name a file [filename].bak? 'filename' looks like the name of a property that doesn't exist in Nant. Just going by gut feel here.